vite-pwa / vite-plugin-pwa

Zero-config PWA for Vite
https://vite-pwa-org.netlify.app/
MIT License
2.87k stars 194 forks source link

Error: Dynamic require of "workbox-build" is not supported #667

Open BernardoSM opened 3 months ago

BernardoSM commented 3 months ago

My local computer config that doesn't show the error below: ✅

My gh actions config that shows the error below: 🚨

Error:  Dynamic require of "workbox-build" is not supported
  at /data/runners/one/_work/apps-monorepo/apps-monorepo/node_modules/vite-plugin-pwa/dist/chunk-UB6OAFZF.js:6:9
  at loadWorkboxBuild (/data/runners/one/_work/apps-monorepo/apps-monorepo/node_modules/vite-plugin-pwa/dist/index.js:300:12)
  at async Promise.all (index 0)
  at async generateInjectManifest (/data/runners/one/_work/apps-monorepo/apps-monorepo/node_modules/vite-plugin-pwa/dist/index.js:356:30)
  at async _generateSW (/data/runners/one/_work/apps-monorepo/apps-monorepo/node_modules/vite-plugin-pwa/dist/index.js:478:5)
  at async Object.generateSW (/data/runners/one/_work/apps-monorepo/apps-monorepo/node_modules/vite-plugin-pwa/dist/index.js:581:14)
  at async regeneratePWA (/data/runners/one/_work/apps-monorepo/apps-monorepo/node_modules/@vite-pwa/nuxt/dist/module.mjs:108:3)
  at async /data/runners/one/_work/apps-monorepo/apps-monorepo/node_modules/@vite-pwa/nuxt/dist/module.mjs:291:11
  at async /data/runners/one/_work/apps-monorepo/apps-monorepo/node_modules/nuxt/dist/index.mjs:3295:7
  at async build (/data/runners/one/_work/apps-monorepo/apps-monorepo/node_modules/nitropack/dist/shared/nitro.4ea992bc.mjs:2334:3) 

Error:  Dynamic require of "workbox-build" is not supported
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
Error:  command finished with error: command (/data/runners/one/_work/apps-monorepo/apps-monorepo/apps/pay) /tmp/yarn--1708439830980-0.8439479944659141/yarn run build exited (1)
Error: pay#build: command (/data/runners/one/_work/apps-monorepo/apps-monorepo/apps/pay) /tmp/yarn--1708439830980-0.8439479944659141/yarn run build exited (1)
BernardoSM commented 3 months ago

Hi guys, I have updates. I updated my github runner to macos-14 and isn't showing the error anymore. The bad part is that we can't use macos-14, we have a self hosted runner that works on ubuntu-latest, so we need to get this fix for ubuntu.

GH Action on macos-14 that doesn't show the error:

buddh4 commented 4 weeks ago

I could fix this issue by adding "workbox-build": "^7.1.0" to my devDependencies.