Skip to content
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

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

Open
mzkmzk opened this issue Jul 8, 2020 · 0 comments

Comments

@mzkmzk
Copy link

mzkmzk commented Jul 8, 2020

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
 }

var update, remove
var styleElement = document.querySelector('style[' + ssrIdKey + '~="' + obj.id + '"]')

pull request: #45

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant