-
-
Notifications
You must be signed in to change notification settings - Fork 33.8k
Closed
Description
Version
2.4.2
Reproduction link
https://github.com/nekuz0r/vuejs-ssr-styles-issue
Steps to reproduce
npm run build
npm run startWhat is expected?
context.styles to be defined
What is actually happening?
context.styles is undefined when runInNewContext is equal false or 'once'
context.styles getter is not set on the new context created when
runInNewContext is equal to false or once.
vue-style-loader is defining a getter for context.styles property
(https://github.com/vuejs/vue-style-loader/blob/master/lib/addStylesServer.js#L9)
When runInNewContext is false or once, VueJS is copying the _styles
property in userContext from initialContext but the styles getter is not.
(
| userContext._styles = deepClone(initialContext._styles) |
Adding the following line after that one fixes the issue
Object.defineProperty(userContext, 'styles',
Object.getOwnPropertyDescriptor(initialContext, 'styles')
)Metadata
Metadata
Assignees
Labels
No labels