vue-style-loader icon indicating copy to clipboard operation
vue-style-loader copied to clipboard

vue-compoennt will happen when ssr is packaged in other projects. document is undefiend

Open mzkmzk opened this issue 5 years ago • 0 comments

Background:

I have a vue component library (my-component) and another nuxt project (my-project), my-project uses my_component through npm,

my-component is packaged in the form of webpack target=web and published to npm

Question:

my-project needs to be compatible with both ssr and spa (non-ssr)

nuxt mode: universal packaging

npm run build & npm run start will report an error document is undefined

Solve:

My idea is whether to add a judgment before this

if (!hasDocument) {
   return noop
 }

https://github.com/vuejs/vue-style-loader/blob/477c25e1a506c54e18cb443f7981aed6d4e80e65/lib/addStylesClient.js#L119-L120

pull request: #45

mzkmzk avatar Jul 08 '20 03:07 mzkmzk