-
-
Notifications
You must be signed in to change notification settings - Fork 8.3k
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
renderToStream causes error in some cases. #3846
Comments
I found that the reason why the tests passed is jest mutates Promise. Emmm... |
The error comes from replit not implementing the needed functionality |
@posva The original example is simplified to help people find the crucial part. I've update it. Now it is the original logic extracted from a vue test case. The error happens in the same way. |
the code sample runs fine in node 14: // index.mjs
import { createApp, resolveComponent, h } from 'vue'
import { renderToStream as _renderToStream } from '@vue/server-renderer'
const app = createApp({
render() {
const Foo = resolveComponent('foo')
return h(Foo)
},
})
app.component('foo', {
render: () => h('div', 'foo'),
})
const promisifyStream = (stream) => {
return new Promise((resolve, reject) => {
let result = ''
console.log('ondata')
stream.on('data', (data) => {
result += data
})
stream.on('error', () => {
reject(result)
})
stream.on('end', () => {
resolve(result)
})
})
}
const renderToStream = (app) => promisifyStream(_renderToStream(app))
renderToStream(app).then((v) => {
console.log(v)
}) Do you have a boiled down reproduction that fails? |
https://github.com/07akioni/vue-ssr-bug-reprod (the same example) The
|
I think the problem is you shouldn't be using |
All the test cases do with events. I'm not quite good at node. Is there any best practice? |
Version
3.0.11
Reproduction link
https://replit.com/@07akioni/vuessr
Steps to reproduce
Follow the link.
What is expected?
No error.
What is actually happening?
It's wired that in stackbliz web container and vue's jest test there is no error.
https://stackblitz.com/edit/node-daswhe?file=index.js
The text was updated successfully, but these errors were encountered: