-
-
Notifications
You must be signed in to change notification settings - Fork 5.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
The bundler generates a "rogue" "export default Fl();" if I import nostr-tools in entry point #10035
Comments
Running the reproduction on stackblitz, there isn't any |
Hello @Giszmo. Please provide a minimal reproduction using a GitHub repository or StackBlitz. Issues marked with |
Are you sure this is not a problem with StackBlitz cause it wouldn't build the service-workers? It runs dev mode which won't do service-workers as per sveltejs/kit#5479 |
I've ran it on my local but there isn't any. So I'm sure this is not a problem with stackblitz. |
|
If you are not familiar with podman, docker should work with the same syntax. |
Ok. So you mean It seems svelte-kit builds service worker to ESM format. The error is happening because you're importing ESM service worker with I don't know much about svelte-kit's internals but I think there isn't a bug in Vite here. |
@sapphi-red FYI: What we do in pwa plugin is this: On dev with plugin dev enabled, we need the type module when registering the sw and delegates sw build to Vite when using custom sw: Otherwise we fallback to workbox-build. I think the problem is that kit will never build the sw, current/latest and previous versions: talking with Ben, Rich always reject to include workbox-build and so ppl should use |
@sapphi-red you can also check my summary in kit issue |
I do think there's an issue in Vite here because I wouldn't expect the output to contain any We can workaround it on the SvelteKit side by changing the output format to |
Describe the bug
In src/service-worker.ts I have the sole line:
but the bundle (build/service-worker.js) contains:
The same happens if I
import nostr from 'nostr-tools'
(or probably anything other nostr-tools.My bundle is free of exports when importing
Dexie from 'dexie'
or a bunch of other imports.I tried to figure out in the vite discord if this "transient" export might be a feature of sorts but I'm more and more convinced it is a bug in the bundler.
This bug was originally reported here.
Reproduction
https://github.com/Giszmo/tmpForBugReport is a blank svelteKit project with the added dependency
nostr-tools
and src/service-worker.ts` consisting of only an import from that dependency.System Info
Used Package Manager
npm
Logs
$ npm run build && npm run preview
... (no errors)
Chromium dev console:
Uncaught SyntaxError: Unexpected token 'export' (at service-worker.js:6207:1)
Validations
The text was updated successfully, but these errors were encountered: