Skip to content
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

vite sourcemap: 'hidden' doesn't quite work #566

Closed
719media opened this issue Sep 14, 2023 · 3 comments · Fixed by #629
Closed

vite sourcemap: 'hidden' doesn't quite work #566

719media opened this issue Sep 14, 2023 · 3 comments · Fixed by #629

Comments

@719media
Copy link
Contributor

719media commented Sep 14, 2023

If vite config is build.sourcemap: 'hidden';, the sourcemap is correctly generated for service-worker.js.map and workbox.js.map, but the sourceMappingURL is erroneously still included in the minified js files service-worker.js and workbox.js, even tho it should be hidden from inclusion at the end of the files.

It looks like vite-plugin-pwa coerces the value of build.sourcemap to a boolean, which means it isn't able to properly use the value.

@719media
Copy link
Contributor Author

I see the real issue is workbox:
GoogleChrome/workbox#2559

Once (if ever) this is fixed, it will then need to be updated in this repo...

@userquin
Copy link
Member

userquin commented Dec 29, 2023

@719media I guess the problem in Vite build and/or workbox-build: by default the pwa plugin will build the sw using es format, esbuild will be used (#629 includes the sourcefile), but I'm not sure what happens when calling workbox injectManifest... (esbuild doesn't have hidden, I need to check the code in Vite repo to check how it is used when configuring esbuild)

FYI: We're checking this another repo, this repo will use it soon, it seems very active (it is a workbox fork):
https://github.com/serwist/serwist

@userquin
Copy link
Member

userquin commented Dec 29, 2023

@719media should be fixed in #629 , you will be able to add this 4 new options to injectManifest:

  • minify
  • sourcemap
  • enableWorkboxModulesLogs
  • target

imagen

imagen

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants