QwikDev / QwikDev/qwik

[🐞] module import issue in generated service worker

Open
#8,075 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement PR welcomed router
Dominant language
TypeScript
Stars
22.1k
Forks
1.4k
Avg merge
1d 10h
Merged PRs (30d)
52

Description

Which component is affected?

Qwik City (routing)

Describe the bug

a module import issue:

Uncaught SyntaxError: Cannot use import statement outside a module (at service-worker.js:1:1)

import{openDB as t}from"./index3.js";self.addEventListener("install",()=>self.skipWaiting());self.addEventListener("activate",e=>{e.waitUntil(t("test",1).then(()=>console.log("DB opened")))});

we need to fix qwik bundler to inline imported module

Reproduction

https://github.com/makinghappen/qwik-sw-test

Steps to reproduce

No response

System Info
qwik 1.17.0
Additional Information

No response

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the linked reproduction and inspect the generated service-worker.js output and the Qwik bundler path that produces it. Reproduce the import error with Qwik 1.17.0, then verify that the imported module is inlined in the generated service worker and the browser no longer reports an import syntax error.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
build-system, web-dev
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.