-
-
Notifications
You must be signed in to change notification settings - Fork 25
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
Uncaught SyntaxError: Unexpected token 'export' (at entry.worker.js:5666:1) #239
Comments
What does your entry worker look like? |
The built service worker is meant to be a standalone js file, meaning no exports. But somehow, your entry.worker file gets built with |
The entry worker looks like this https://gist.github.com/kayluhb/d2e1d0cac8b99d53af45339aa52972e2 |
@ShafSpecs I had similar problem, check vite-pwa/vite-plugin-pwa#629 |
Thanks! Would try and replicate it here as well 👍 |
@userquin Would building into var __getOwnPropNames = Object.getOwnPropertyNames;
var __commonJS = (cb, mod) => function __require() {
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
};
var require_entry_worker = __commonJS({
// ...
});
export default require_entry_worker(); Instead of as a script |
Rename the js file to mjs (change the rollup input to the mjs file) before Vite build call, then rename it back to the original (don't forget to change also sourcemap file and reference in the js file): the problem is about using esbuild in Vite minify option (the default): check Vite issue vitejs/vite#15379 (comment) You can try switching Vite minify option to terser (will require adding the dependency). |
Hello!
I'm trying to implement remix-pwa and I'm having an issue with the browser loading the
entry.worker.js
versions:
"@remix-pwa/dev": "^3.0.5",
"@remix-pwa/worker-runtime": "^2.1.2",
"@remix-run/react": "^2.8.0",
"@remix-run/server-runtime": "^2.8.0",
my vite config looks like this
Any ideas on what might be wrong w/ my config?
The text was updated successfully, but these errors were encountered: