-
-
Notifications
You must be signed in to change notification settings - Fork 33.7k
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
[SSR] context.styles is undefined when runInNewContext !== true
#6353
Comments
It causes SSR issue like vuejs/vue#6353
@yyx990803 It's a typo which makes |
@JounQin are you sure? Even if it's not enumerable it should still be present. (I haven't got time to properly investigate this issue yet) |
It causes SSR issue like vuejs/vue#6353
Ah, sorry I read it wrong, I used to extract all styles of first chunk into However, Object.defineProperty(userContext, 'styles',
Object.getOwnPropertyDescriptor(initialContext, 'styles')
) sounds not good to me, because |
fix vuejs#6603, (regression caused by attempt to fix vuejs#6353)
fix vuejs#6603, (regression caused by attempt to fix vuejs#6353)
Version
2.4.2
Reproduction link
https://github.com/nekuz0r/vuejs-ssr-styles-issue
Steps to reproduce
What is expected?
context.styles
to be definedWhat is actually happening?
context.styles
isundefined
whenrunInNewContext
is equalfalse
or'once'
context.styles getter is not set on the new context created when
runInNewContext
is equal tofalse
oronce
.vue-style-loader
is defining a getter forcontext.styles
property(https://github.com/vuejs/vue-style-loader/blob/master/lib/addStylesServer.js#L9)
When
runInNewContext
isfalse
oronce
, VueJS is copying the_styles
property in
userContext
frominitialContext
but thestyles
getter is not.(
vue/src/server/bundle-renderer/create-bundle-runner.js
Line 131 in 8ff77a2
Adding the following line after that one fixes the issue
The text was updated successfully, but these errors were encountered: