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
Module not found after uniapp build as h5 version #636
Comments
add |
I tried it, but the problem remains. The latest modifications have been submitted to the sample repository. |
Try using dynamic import inside launch instead static import here: https://github.com/censujiang/vite-plugin-pwa-with-uniapp-test/blob/main/src/App.vue#L4C53-L4C56 Why are you registering the sw twice (the virtual will register the sw: https://github.com/censujiang/vite-plugin-pwa-with-uniapp-test/blob/main/src/App.vue#L8)? Anyway, I haven't checked what's doing |
|
Remove virtual pwa call (and static import) and register the sw yourself: https://vite-pwa-org.netlify.app/guide/service-worker-without-pwa-capabilities.html#registering-of-the-service-worker-in-your-app |
Regarding question 1, this method is useless. The specific error is as follows TypeError: Failed to resolve module specifier '..-..-..-..-@vite-plugin-pwa-virtual:pwa-register-vue.eca0a462.js'
at index-14fb415a.js:6:86683
at t (index-14fb415a.js:1:762)
at index-14fb415a.js:6:86676
at Dn (index-14fb415a.js:1:19096)
at Un (index-14fb415a.js:1:19174)
at t.__weh.t.__weh (index-14fb415a.js:1:33192)
at Y (index-14fb415a.js:1:4319)
at n (index-14fb415a.js:6:87275) |
This method is currently valid in HTTPS connections with valid SSL certificates, which means that currently for uniapp, we can only register and manage it manually? |
Weird, this is the code in the entry point: const {useRegisterSW: e} = await t((()=>import("..-..-..-..-@vite-plugin-pwa-virtual:pwa-register-vue.911fca92.js")), [], import.meta.url); |
Using your SB playground and registering the sw manually seems to work: |
Yes, I also feel very strange. Do you think it is a problem with your automatic registration strategy, Vite's packaging problem, or a problem with uniapp itself? |
No idea, I'll check your repo later on my local |
This is really a wonderful thing. It should be a problem of packaging policy control. |
If NOTE: that shouldn't be a problem since the sw seems to be generated properly |
In other words, uniapp has changed the behavior of vite, but there is no good back compatibility. If this is determined, I need to feedback this problem to the project team of uniapp |
I just took a look at your latest modification. Is there a problem with file name generation? |
On Windows fs you cannot use |
I would like to ask a question, in manual injection mode, is it possible to implement page reloading (window.location.reload()) without importing a virtual module? The mention in the document makes me a little vague. https://vite-pwa-org.netlify.app/guide/auto-update.html#automatic-reload |
Don't remove let refreshing;
navigator.serviceWorker.addEventListener('controllerchange',
function() {
if (refreshing) return;
refreshing = true;
window.location.reload();
}
); |
Error report details
Reproduction example
https://github.com/censujiang/vite-plugin-pwa-with-uniapp-test
https://stackblitz.com/github/censujiang/vite-plugin-pwa-with-uniapp-test
Reproduction method
In the provided sample project, execute the commands in order, and you can find the problem and report the error in the opened browser window.
The text was updated successfully, but these errors were encountered: