Skip to content
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

Cloudflare Pages build fails. Cannot resolve "unenv/runtime/node/process/index/" #2631

Open
ryoid opened this issue Jul 24, 2024 · 2 comments

Comments

@ryoid
Copy link

ryoid commented Jul 24, 2024

Environment

Reproduction

Run build in Stackblitz

Made from starter template and adding readable-stream

Describe the bug

Unable to build for Cloudflare Pages with readable-stream

Additional context

Related Issues

Logs

[12:58:23 AM]  ERROR  Cannot resolve "unenv/runtime/node/process/index/" from "/home/ryoid/nitro-cfpages-unenv-repo/node_modules/.pnpm/[email protected]/node_modules/readable-stream/lib/internal/streams/pipeline.js" and externals are not allowed!

  at Object.resolveId (node_modules/.pnpm/[email protected]/node_modules/nitropack/dist/nitro.mjs:2003:17)
  at async PluginDriver.hookFirstAndGetPlugin (node_modules/.pnpm/[email protected]/node_modules/rollup/dist/es/shared/node-entry.js:19733:28)
  at async resolveId (node_modules/.pnpm/[email protected]/node_modules/rollup/dist/es/shared/node-entry.js:18414:26)
  at async ModuleLoader.resolveId (node_modules/.pnpm/[email protected]/node_modules/rollup/dist/es/shared/node-entry.js:18817:15)
  at async PluginDriver.hookFirstAndGetPlugin (node_modules/.pnpm/[email protected]/node_modules/rollup/dist/es/shared/node-entry.js:19733:28)
  at async resolveId (node_modules/.pnpm/[email protected]/node_modules/rollup/dist/es/shared/node-entry.js:18414:26)
  at async ModuleLoader.resolveId (node_modules/.pnpm/[email protected]/node_modules/rollup/dist/es/shared/node-entry.js:18817:15)
  at async eval (node_modules/.pnpm/@[email protected][email protected]/node_modules/@rollup/plugin-commonjs/dist/es/index.js:800:16)
  at async eval (node_modules/.pnpm/@[email protected][email protected]/node_modules/@rollup/plugin-commonjs/dist/es/index.js:792:32)
@ryoid
Copy link
Author

ryoid commented Jul 24, 2024

After some tinkering it seems like the issue is because the readable-stream library use require('process/'), with the trailing slash. Patching unenv to also include process/ allows build to complete. But I'm not sure if there any implications of this.

Alternatively aliasing it also works.

alias: {
    "process/": "process"
}

@Dmytro-Tihunov

This comment was marked as off-topic.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants