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

Broken SSR bundle for worker environments #4199

Closed
frandiox opened this issue Jul 27, 2021 · 0 comments
Closed

Broken SSR bundle for worker environments #4199

frandiox opened this issue Jul 27, 2021 · 0 comments
Labels
🐞 bug Something isn't working scope: ssr

Comments

@frandiox
Copy link

Version

3.1.5

Reproduction link

https://github.com/frandiox/vite-vue-bundle-issue

Steps to reproduce

yarn && yarn build && yarn test

What is expected?

It should create a functional SSR bundle.

What is actually happening?

The created SSR bundle is missing ssrUtils so the app crashes since it tries to read a property of null. It is likely related to this line: https://github.com/vuejs/vue-next/blob/3a75d5d6942a1743789192dca9161f7c30a71e58/packages/runtime-core/src/index.ts#L316


SSR bundle is useful for environments such as workers, where there is no import or require at run time.
The bundle is generated correctly using Webpack or ESBuild but I could not make it work with Vite.

A related problem is that Vue imports Node's stream at the top of the bundle (it is used when calling renderToStream), which crashes the worker. It is currently necessary mocking the stream module in the bundler.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
🐞 bug Something isn't working scope: ssr
Projects
None yet
Development

No branches or pull requests

2 participants