Skip to content

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

Open
@mzkmzk

Description

@mzkmzk

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions