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
no SW.js when registerSW() function is in pwa.js file with particular import manner #694
Comments
I guess the problem is with Astro... With Thanks |
Why do you need to include the script this way? if you disable the pwa, the astro pwa integration will create a dummy virtual module. |
Because when I want to disable the PWA integration I don't want anything in the build that related to pwa integration... So ok for "static" script tag load ... |
See this repository to reproduce :
https://gitlab.com/ekliptus49/vite-plugin-pwa-astro-minimal-sw-issue
See minimum this file : https://gitlab.com/ekliptus49/vite-plugin-pwa-astro-minimal-sw-issue/-/blob/master/src/pages/index.astro
pnpm build
do not generate SW.js (and workbox-x.js) whenregisterSW()
function is inpwa.js
that was conditionally (true) import in html.like this :
{ true && <script src="/src/pwa.ts"></script> }
in index.astro fileI guess vite-plugin-pwa try to determine if the registerSW() was triggered before generate SW.
And the conditionnal html script import in
{...}
isn't follow.. ?I don't have found any " registerSW() triggered flag " on vite-plugin-pwa source code.
Why registerSW() call is needed to generate SW.js with genrateSW strategie ???
The text was updated successfully, but these errors were encountered: