vite-plugin-pwa: Module not found after uniapp build as h5 version

Error report details

Uncaught (in promise) TypeError: Failed to resolve module specifier '..-node_modules-.pnpm-workbox-window@7.0.0-node_modules-workbox-window-build-workbox-window.prod.es5.1e1a3f8e.js'
    at index-487d5823.js:6:86496
    at t (index-487d5823.js:1:762)
    at index-487d5823.js:6:86489
    at u.immediate (index-487d5823.js:6:86942)
    at jh (index-487d5823.js:6:86968)
    at index-487d5823.js:6:87685
    at Dn (index-487d5823.js:1:19096)
    at Un (index-487d5823.js:1:19174)
    at t.__weh.t.__weh (index-487d5823.js:1:33192)
    at Y (index-487d5823.js:1:4319)

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.

pnpm i
pnpm run build
pnpm run preview

About this issue

  • Original URL
  • State: open
  • Created 6 months ago
  • Comments: 21 (11 by maintainers)

Commits related to this issue

Most upvoted comments

Don’t remove refreshing flag, if you’re testing it via Chrome Dev Tools Update on Reload button:

let refreshing;
navigator.serviceWorker.addEventListener('controllerchange',
  function() {
    if (refreshing) return;
    refreshing = true;
    window.location.reload();
  }
);

On Windows fs you cannot use : in the name (iirc in any fs).