[SSR] context.styles is undefined when runInNewContext !== true
#6353
Closed
Description
Version
2.4.2
Reproduction link
https://github.com/nekuz0r/vuejs-ssr-styles-issue
Steps to reproduce
npm run build
npm run start
What 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.
(
Adding the following line after that one fixes the issue
Object.defineProperty(userContext, 'styles',
Object.getOwnPropertyDescriptor(initialContext, 'styles')
)
Metadata
Assignees
Labels
No labels