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

Incompatible with isomorphic (document not defined) #1126

Closed
clayrisser opened this issue Dec 14, 2018 · 4 comments
Closed

Incompatible with isomorphic (document not defined) #1126

clayrisser opened this issue Dec 14, 2018 · 4 comments

Comments

@clayrisser
Copy link

If you are reporting a bug or having an issue setting up React Hot Loader, please fill in below. For feature requests, feel free to remove this template entirely.

Description

When I try to use this, I get a document undefined error. This used to work just fine, but only recently started breaking. I haven't changed my code at all. I've been using this plugin just fine for months. My application is isomorphic, so the error is coming from the node server. I'm not sure what changed, but it should not be accessing the document when running isomorphic. I'm not sure what was changed in this codebase to break it. Again, previous versions work just fine.

The exact line where the project is failing is the following . . .

let div = document.querySelector('.react-hot-loader-error-overlay')

Expected behavior

The application should start without errors.

Actual behavior

I get the following error . . .

ReferenceError: document is not defined
    at initErrorOverlay (webpack-internal:///../../packages/web-isomorphic/node_modules/react-hot-loader/dist/react-hot-loader.development.js:1548:13)
    at clearExceptions (webpack-internal:///../../packages/web-isomorphic/node_modules/react-hot-loader/dist/react-hot-loader.development.js:1567:3)
    at hot (webpack-internal:///../../packages/web-isomorphic/node_modules/react-hot-loader/dist/react-hot-loader.development.js:2934:3)
    at Object.eval (webpack-internal:///./node_modules/@reactant/web-isomorphic/lib/Reactant.js:66:43)
    at eval (webpack-internal:///./node_modules/@reactant/web-isomorphic/lib/Reactant.js:67:30)
    at Object../node_modules/@reactant/web-isomorphic/lib/Reactant.js (/Users/codejamninja/Projects/reactant/examples/web-isomorphic/dist/web/server.js:2526:1)
    at __webpack_require__ (/Users/codejamninja/Projects/reactant/examples/web-isomorphic/dist/web/server.js:683:30)
    at fn (/Users/codejamninja/Projects/reactant/examples/web-isomorphic/dist/web/server.js:60:20)
    at eval (webpack-internal:///./node_modules/@reactant/web-isomorphic/lib/ServerApp.js:54:17)
    at Object../node_modules/@reactant/web-isomorphic/lib/ServerApp.js (/Users/codejamninja/Projects/reactant/examples/web-isomorphic/dist/web/server.js:2538:1)
    at __webpack_require__ (/Users/codejamninja/Projects/reactant/examples/web-isomorphic/dist/web/server.js:683:30)
    at fn (/Users/codejamninja/Projects/reactant/examples/web-isomorphic/dist/web/server.js:60:20)
    at Object.eval (webpack-internal:///./node_modules/@reactant/web-isomorphic/ServerApp.js:1:152)
    at eval (webpack-internal:///./node_modules/@reactant/web-isomorphic/ServerApp.js:3:30)
    at Object../node_modules/@reactant/web-isomorphic/ServerApp.js (/Users/codejamninja/Projects/reactant/examples/web-isomorphic/dist/web/server.js:2514:1)
    at __webpack_require__ (/Users/codejamninja/Projects/reactant/examples/web-isomorphic/dist/web/server.js:683:30)

Environment

React Hot Loader version: 4.6.0

  1. node -v: v8.12.0
  2. npm -v: v6.4.1

Then, specify:

  1. Operating system: Ubuntu 18.10
  2. Browser and version: Chrome 71

Reproducible Demo

https://github.com/codejamninja/reactant/tree/master/examples/web-isomorphic

@theKashey
Copy link
Collaborator

This overlay was added in 4.6.0. I thought that it could lead to some issues, but that code should not be called on server side.

@clayrisser
Copy link
Author

Ok, I'll pull it out of the server side

@theKashey
Copy link
Collaborator

Try 4.6.1

@clayrisser
Copy link
Author

Thanks, that worked

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

2 participants