content icon indicating copy to clipboard operation
content copied to clipboard

Nitro `service-worker` preset broken on StackBlitz/PNPM

Open qin-guan opened this issue 3 years ago • 2 comments

Environment

  • Operating System: Linux
  • Node Version: v16.14.2
  • Nuxt Version: 3.0.0-rc.8
  • Package Manager: [email protected]
  • Builder: vite
  • User Config: ssr, nitro, modules
  • Runtime Modules: @nuxt/[email protected]
  • Build Modules: -

Reproduction

https://stackblitz.com/edit/github-6kcvvz?file=nuxt.config.ts

Describe the bug

Using Nuxt Content with the service-worker preset on StackBlitz throws the error below during build. The error also occurs when using PNPM locally. Using Yarn resolves the issue.

Additional context

Discovered while investigating https://github.com/nuxt/content/issues/1365

Logs

WARN  Could not resolve import "parse5/lib/parser/index.js" in /home/projects/github-6kcvvz/node_modules/hast-util-raw/lib/index.js using exports defined in /home/projects/github-6kcvvz/node_modules/parse5/package.json.


 ERROR  Rollup error: Cannot resolve "parse5/lib/parser/index.js" from "/home/projects/github-6kcvvz/node_modules/hast-util-raw/lib/index.js" and externals are not allowed!


 ERROR  Cannot resolve "parse5/lib/parser/index.js" from "/home/projects/github-6kcvvz/node_modules/hast-util-raw/lib/index.js" and externals are not allowed!

  at Object.resolveId (node_modules/nitropack/dist/shared/nitro.8d0213e3.mjs:1073:17)
  at async resolveId (node_modules/rollup/dist/es/shared/rollup.js:21759:26)
  at async ModuleLoader.resolveId (node_modules/rollup/dist/es/shared/rollup.js:22059:19)
  at async Object.resolveId (node_modules/@rollup/plugin-commonjs/dist/es/index.js:589:10)
  at async resolveId (node_modules/rollup/dist/es/shared/rollup.js:21759:26)
  at async ModuleLoader.resolveId (node_modules/rollup/dist/es/shared/rollup.js:22059:19)
  at async eval (node_modules/rollup/dist/es/shared/rollup.js:22342:42)
  at async Promise.all (index 0)

qin-guan avatar Aug 15 '22 02:08 qin-guan

Hi @qin-guan. I would suggest to track the issue via https://github.com/nuxt/content/issues/1438. There seem multiple incompatibility issues with Content and Worker* targets.

pi0 avatar Aug 15 '22 12:08 pi0

Ah, I didn’t notice that. The two issues don’t seem too related though 😅 since this seems specific to PNPM/Turbo Package Manager. I cannot reproduce it with Yarn or NPM.

qin-guan avatar Aug 15 '22 13:08 qin-guan