-
-
Notifications
You must be signed in to change notification settings - Fork 221
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
fix(dev): type module and custom sw not working when not using virtual modules #361
Conversation
✅ Deploy Preview for vite-plugin-pwa ready!
To edit notification comments on pull requests, go to your Netlify site settings. |
@ARYX01 we use |
@antfu it is weird, Vite 2 seems to work properly since it is forcing to use a base (by default
The same code with Vite 3 will not work, it seems it is not removing one slash: I think it is because the target project is not using the This PR will just remove the |
I will change the EDIT: previous will not work, since we need the module to be processed by Vite. |
@@ -37,7 +38,12 @@ export function DevPlugin(ctx: PWAPluginContext): Plugin { | |||
|
|||
return html.replace( | |||
'</body>', | |||
`<script type="module" src="${options.base}${DEV_SW_VIRTUAL}"></script></body>`, | |||
` | |||
<script type="module"> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@antfu should we check CORS here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We could leave it for now, and bring it back if there is really a valid case.
After adding an reload prompt component that uses |
we only need to fix the SSR: #364 |
Description
devOptions.type: 'module' now using it for generating inside the registerSW.js
Linked Issues
closes #359
Additional context
The dev-dist folder is unreachable when running dev vite3.
I suggest not creating this folder and instead add the files inside the ws /@vite-plugin-pwa/ like the pwa-entry-point-loaded and point there the registerPath