WebpackError: ReferenceError: document is not defined
See original GitHub issueVersion React-Formik-UI @ 2.3.3 (same problem with any 2.3 patch)
Mode
The mode you are using React-Formik-UI in,
[Default]
Describe the bug Didn’t change anything and seeing this error
16309 | var accepts = unwrapExports(dist);
16310 |
> 16311 | var supportMultiple = 'multiple' in document.createElement('input'); // Firefox versions prior to 53 return a bogus MIME type for every file drag, so dragovers with
| ^
16312 | // that MIME type will always be accepted
16313 |
16314 | function fileAccepted(file, accept) {
WebpackError: ReferenceError: document is not defined
- index.js:16311 Module../node_modules/react-formik-ui/dist/index.js
[lib]/[react-formik-ui]/dist/index.js:16311:1
- bootstrap:19 __webpack_require__
lib/webpack/bootstrap:19:1
- bootstrap:19 __webpack_require__
lib/webpack/bootstrap:19:1
- bootstrap:19 __webpack_require__
lib/webpack/bootstrap:19:1
- sync-requires.js:9 Object../.cache/sync-requires.js
lib/.cache/sync-requires.js:9:55
- bootstrap:19 __webpack_require__
lib/webpack/bootstrap:19:1
- static-entry.js:9 Module../.cache/static-entry.js
lib/.cache/static-entry.js:9:22
- bootstrap:19 __webpack_require__
lib/webpack/bootstrap:19:1
- bootstrap:83
lib/webpack/bootstrap:83:1
- universalModuleDefinition:3 webpackUniversalModuleDefinition
lib/webpack/universalModuleDefinition:3:1
- universalModuleDefinition:10 Object.<anonymous>
lib/webpack/universalModuleDefinition:10:2
- static-entry.js:103 Module._compile
lib/.cache/static-entry.js:103:3
- static-entry.js:115 Object.Module._extensions..js
lib/.cache/static-entry.js:115:7
… Sorry I am going to be lazy on the description since I guess the error will be obvious for you to find. If it is not, tell me what to try or what to tell you @KaiHotz.
Additional context This happens when building the website with GatsbyJS Version 2.2.5 is going fine so I rolled back
Issue Analytics
- State:
- Created 5 years ago
- Comments:7 (4 by maintainers)
Top Results From Across the Web
reactjs - WebpackError: ReferenceError: document is not defined
I am getting an error building my project on netlify (WebpackError: ReferenceError: document is not defined). In develop works fine!
Read more >WebpackError: ReferenceError: document is not defined - IE ...
Steps to reproduce. Running gatsby build within project folder after declaring const isIE = /*@cc_on! · Expected result. Site builds without ...
Read more >How to fix 'document not defined' in Gatsby Build
The error document is not defined or window is not defined you see when building a gatsby project is as a result of...
Read more >How To Fix ReferenceError document is not defined ... - Isotropic
If you are trying to use the document object and receiving a ReferenceError: document is not defined error then there is a good...
Read more >How to fix ReferenceError: Document is not defined ... - Sabe.io
The most common reason for getting the reference error while on the browser is when you try to access the document object too...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

Thanks for looking at this. If you go that way It means that react-formik-ui is not SSR friendly anymore. That’s a shame IMHO. =/ Usually when I happen to use such a library on a Gatsby Project I conditionally require the lib and and hide the depending components when SSR and only show them when in SPA mode. That is what I will do if you decide to keep things that way. I think a form library should handle SSR but that is just my opinion. You should not worry about it. 😉 I have no clue what good practice are regarding SSR handling in libs like this one. Maybe a way to go would be to beautifully degrade UX when
typeof window === 'undefined'. So you can go as fancy as you’d like but still support a broader range of use cases.Makes sense. Thanks 😃