-
-
Notifications
You must be signed in to change notification settings - Fork 4.8k
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
"Document is not defined" with component library extractCss: false #7747
Comments
not really about nuxt. you need to build so it wont bundle css with document or it wont work in ssr. And it depends on how you build see https://stackoverflow.com/a/56895041/239354 for vue cli for example. Ask in vue cli community :) |
Alright - thanks for your reply anyways! im just desperate because this used to work (i did not come up with the set up of the component library myself but i modelled it after an example repository and it was definitely working in the past with extractCss false...thats why i thought it might be a nuxt/loader problem... |
@saraha33 but it would be great if you share your findings here later. 😊 |
@silvio-e - sure definitely! :) |
i didnt really used vue cli for building, cant help, but in rollup with same issue you need to pass extract: false to rollup vue plugin and it will work |
ok i somewhat found out what the problem is - in my component library i have defined in my package.json:
and it seems for some reason nuxt/webpack uses the "main" (so cjs) build not the "module" reference (and it seems nuxt cant handle the cjs build?)...if i change it to |
Hi everybody,
im not sure if this is a bug or even if yes if it is a nuxt problem (or maybe vue-style-loader?) - im really sorry if it is wrong to post here - please let me know if this should go somewhere different - but for now here we go:
I have this custom library that i want to import to a nuxt project however when I have extractCss false in my library I get a "document is not defined" error message coming from the vue-style-loader addStyle function:
Versions
Reproduction
Steps to reproduce
the component library is actually just an example test project with not much content - to reproduce the issue one would just need to
npm install --save vue-package-test-x@0.0.2-beta.6
(specifically this version because in other versions i tried to do with extractCss: true* and other stuff)also the complete code base could be found here
and then have a fresh nuxt project (but i could also put my nuxt project on github if this would help)
and try to use one of the components like so:
Additional Details
Standard universal ssr app nuxt.config
What is Expected?
the component from the component library should be rendered without error messages
What is actually happening?
error message "document is not defined" as described above
Potentially related issues
I have the feeling this issue sounds similar? vue-style-loader/issues/44
or maybe this one - but it is quite old vue-style-loader/pull/30
The text was updated successfully, but these errors were encountered: