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

Cannot build with Vue framework and Cloudflare adapter #4949

Closed
1 task
kansson opened this issue Oct 1, 2022 · 7 comments
Closed
1 task

Cannot build with Vue framework and Cloudflare adapter #4949

kansson opened this issue Oct 1, 2022 · 7 comments

Comments

@kansson
Copy link

kansson commented Oct 1, 2022

What version of astro are you using?

1.4.2

Are you using an SSR adapter? If so, which one?

Cloudflare

What package manager are you using?

npm

What operating system are you using?

Linux

Describe the Bug

Open the reproduction and try building the project with npm run build and it will fail with this error.

Installing stream and emitter allows the project to build but is's not ideal.

✘ [ERROR] Could not resolve "stream"

    node_modules/@vue/server-renderer/dist/server-renderer.cjs.js:527:32:
      527 │     const stream = new (require('stream').Readable)({ read() { } })
          ╵                                 ~~~~~~~~

  The package "stream" wasn't found on the file system but is built into node. Are you trying to bundle for node? You can use "platform: 'node'" to do that, which will remove this error.

✘ [ERROR] Could not resolve "stream"

    node_modules/@vue/server-renderer/dist/server-renderer.cjs.prod.js:524:32:
      524 │     const stream = new (require('stream').Readable)({ read() { } })
          ╵                                 ~~~~~~~~

  The package "stream" wasn't found on the file system but is built into node. Are you trying to bundle for node? You can use "platform: 'node'" to do that, which will remove this error.

 error   Build failed with 2 errors:
  node_modules/@vue/server-renderer/dist/server-renderer.cjs.js:527:32: ERROR: Could not resolve "stream"
  node_modules/@vue/server-renderer/dist/server-renderer.cjs.prod.js:524:32: ERROR: Could not resolve "stream"
  File:
    node_modules/@vue/server-renderer/dist/server-renderer.cjs.js
  Code:
      526 | function renderToNodeStream(input, context = {}) {
    > 527 |     const stream = new (require('stream').Readable)({ read() { } })
          |                                ^
      528 |         ;
      529 |     if (!stream) {
      530 |         throw new Error(`ESM build of renderToStream() does not support renderToNodeStream(). ` +
    
  Stacktrace:
Error: Build failed with 2 errors:
node_modules/@vue/server-renderer/dist/server-renderer.cjs.js:527:32: ERROR: Could not resolve "stream"
node_modules/@vue/server-renderer/dist/server-renderer.cjs.prod.js:524:32: ERROR: Could not resolve "stream"
    at failureErrorWithLog (/home/projects/github-fuvqcy/node_modules/esbuild/lib/main.js:1624:15)
    at eval (/home/projects/github-fuvqcy/node_modules/esbuild/lib/main.js:1266:28)
    at runOnEndCallbacks (/home/projects/github-fuvqcy/node_modules/esbuild/lib/main.js:1179:65)
    at buildResponseToResult (/home/projects/github-fuvqcy/node_modules/esbuild/lib/main.js:1264:7)
    at eval (/home/projects/github-fuvqcy/node_modules/esbuild/lib/main.js:1377:14)
    at eval (/home/projects/github-fuvqcy/node_modules/esbuild/lib/main.js:678:9)
    at handleIncomingPacket (/home/projects/github-fuvqcy/node_modules/esbuild/lib/main.js:775:9)
    at Socket.readFromStdout (/home/projects/github-fuvqcy/node_modules/esbuild/lib/main.js:644:7)
    at EventEmitter.emit (https://github-fuvqcy-tbf9ts8u.w.staticblitz.com/blitz.bc6680fa6a19b40b511d3d540df9ce55a844166f.js:6:155574)
    at S.emit (https://github-fuvqcy-tbf9ts8u.w.staticblitz.com/blitz.bc6680fa6a19b40b511d3d540df9ce55a844166f.js:6:1408891)

Link to Minimal Reproducible Example

https://stackblitz.com/edit/github-fuvqcy

Participation

  • I am willing to submit a pull request for this issue.
@arstnei0
Copy link
Contributor

arstnei0 commented Oct 3, 2022

I think that this PR is doing about this.

@kansson
Copy link
Author

kansson commented Oct 5, 2022

I think that this PR is doing about this.

So will that PR also solve the problem with the Vue integration?

@arstnei0
Copy link
Contributor

arstnei0 commented Oct 5, 2022

I think that this PR is doing about this.

So will that PR also solve the problem with the Vue integration?

I think so. The problem is about the Cloudflare Integration itself.

@kansson
Copy link
Author

kansson commented Oct 6, 2022

I think that this PR is doing about this.

So will that PR also solve the problem with the Vue integration?

I think so. The problem is about the Cloudflare Integration itself.

Looking forward to the PR getting merged then 👍🏻

@AirBorne04
Copy link
Contributor

yes i was testing the changes also with vue and can confirm that the #4888 works with vue and cloudflare. i have tested the minimal example inside this repo /examples/framework-vue

@matthewp
Copy link
Contributor

matthewp commented Oct 6, 2022

Fixed by #4888

@matthewp matthewp closed this as completed Oct 6, 2022
@kansson
Copy link
Author

kansson commented Oct 6, 2022

Sweet thanks all!

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

No branches or pull requests

4 participants