Skip to content

consuming with webpack for node.js and isomorphic #98

Open

Description

@joshunger

Q. We're using script.js and webpack to bundle for both the browser and node.js. What is the best approach here to provide a fallback?

Current, as expected, I get this error (as expected) -

  var doc = document
            ^

ReferenceError: document is not defined

Which is from this code -

})('$script', function () {
  var doc = document

Activity

  1. Kronuz commented on Sep 6, 2017

    @Kronuz

    document and head variables declaration only need to be moved to the create() function (so improt/require works in server side)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions