final-form / react-final-form

🏁 High performance subscription-based form state management for React
https://final-form.org/react
MIT License
7.39k stars 481 forks source link

next.js, material-ui: window is not defined #462

Open mikepc opened 5 years ago

mikepc commented 5 years ago

Are you submitting a bug report or a feature request?

Bug Report

What is the current behavior?

final-form-material-ui will not allow my next.js project to load.

What is the expected behavior?

My project should load and the behavior in the examples should function normally

Sandbox Link

N/A

What's your environment?

MacOS X, node 11.8.0

  "dependencies": {
    "@material-ui/core": "3.7.1",
    "@material-ui/icons": "3.0.2",
    "@zeit/next-bundle-analyzer": "^0.1.2",
    "@zeit/next-source-maps": "^0.0.3",
    "axios": "^0.18.0",
    "dotenv": "^7.0.0",
    "final-form": "^4.12.0",
    "final-form-material-ui": "^0.3.0",
    "jss": "9.8.7",
    "next": "latest",
    "next-compose-plugins": "^2.1.1",
    "next-images": "^1.1.1",
    "next-redux-saga": "^4.0.1",
    "next-redux-wrapper": "latest",
    "prop-types": "^15.7.2",
    "react": "16.7.0",
    "react-dom": "16.7.0",
    "react-final-form": "^4.1.0",
    "react-jss": "8.6.1",
    "react-redux": "6.0.0",
    "redux": "4.0.1",
    "redux-logger": "^3.0.6",
    "redux-saga": "^1.0.2",
    "redux-thunk": "2.3.0",
    "universal-cookie-express": "^3.1.0",
    "uuid": "^3.3.2",
    "webpack": "^4.30.0"
  }

Other information

ReferenceError: window is not defined
    at Object.<anonymous> (/Users/michael/owlbrite/ge/applications/web/node_modules/final-form-material-ui/dist/final-form-material-ui.min.js:1:1452)
    at Module._compile (internal/modules/cjs/loader.js:736:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:747:10)
    at Module.load (internal/modules/cjs/loader.js:628:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:568:12)
    at Function.Module._load (internal/modules/cjs/loader.js:560:3)
    at Module.require (internal/modules/cjs/loader.js:665:17)
    at require (internal/modules/cjs/helpers.js:20:18)
    at Object.final-form-material-ui (/Users/michael/owlbrite/ge/applications/web/.next/server/static/development/pages/register.js:690:18)

and

TypeError: Cannot read property 'theme' of undefined
    at _Document.render (/Users/michael/owlbrite/ge/applications/web/.next/server/static/development/pages/_document.js:220:28)
    at processChild (/Users/michael/owlbrite/ge/applications/web/node_modules/react-dom/cjs/react-dom-server.node.development.js:2863:18)
    at resolve (/Users/michael/owlbrite/ge/applications/web/node_modules/react-dom/cjs/react-dom-server.node.development.js:2716:5)
    at ReactDOMServerRenderer.render (/Users/michael/owlbrite/ge/applications/web/node_modules/react-dom/cjs/react-dom-server.node.development.js:3100:22)
    at ReactDOMServerRenderer.read (/Users/michael/owlbrite/ge/applications/web/node_modules/react-dom/cjs/react-dom-server.node.development.js:3059:29)
    at renderToStaticMarkup (/Users/michael/owlbrite/ge/applications/web/node_modules/react-dom/cjs/react-dom-server.node.development.js:3541:27)
    at _callee3$ (/Users/michael/owlbrite/ge/applications/web/node_modules/next/dist/server/render.js:393:100)
    at tryCatch (/Users/michael/owlbrite/ge/applications/web/node_modules/regenerator-runtime/runtime.js:62:40)
    at Generator.invoke [as _invoke] (/Users/michael/owlbrite/ge/applications/web/node_modules/regenerator-runtime/runtime.js:288:22)
    at Generator.prototype.(anonymous function) [as next] (/Users/michael/owlbrite/ge/applications/web/node_modules/regenerator-runtime/runtime.js:114:21)
    at asyncGeneratorStep (/Users/michael/owlbrite/ge/applications/web/node_modules/@babel/runtime-corejs2/helpers/asyncToGenerator.js:5:24)
    at _next (/Users/michael/owlbrite/ge/applications/web/node_modules/@babel/runtime-corejs2/helpers/asyncToGenerator.js:27:9)
    at processTicksAndRejections (internal/process/next_tick.js:81:5)
Andarist commented 5 years ago

final-form-material-ui is a separate project, not governed by the author of React Final Form. Could you report the issue there - https://github.com/Deadly0/final-form-material-ui ?

rosskevin commented 5 years ago

...and close your own issue please @mikepc. It's important and meaningful to help maintainers keep their issue tracker tidy.