You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I recently added const isIE = /*@cc_on!@*/ false || !!document.documentMode as a check to see if a user is using Internet Explorer and conditionally add a message asking them to use a modern browser (Chrome/Firefox). While this works as expected using gatsby develop, it fails using gatsby build stating:
error Building static HTML failed
WebpackError: ReferenceError: document is not defined
Steps to reproduce
Running gatsby build within project folder after declaring const isIE = /*@cc_on!@*/ false || !!document.documentMode and running a check on the const {isIE && ()} in one of the js files. Gatsby develop works fine as expected.
Expected result
Site builds without error and conditionally displays message if user is using IE
Actual result
Site unable to build with gatsby build but fine with gatsby develop.
Description
I recently added
const isIE = /*@cc_on!@*/ false || !!document.documentMode
as a check to see if a user is using Internet Explorer and conditionally add a message asking them to use a modern browser (Chrome/Firefox). While this works as expected usinggatsby develop
, it fails usinggatsby build
stating:Steps to reproduce
Running
gatsby build
within project folder after declaringconst isIE = /*@cc_on!@*/ false || !!document.documentMode
and running a check on the const{isIE && ()}
in one of the js files.Gatsby develop
works fine as expected.Expected result
Site builds without error and conditionally displays message if user is using IE
Actual result
Site unable to build with
gatsby build
but fine withgatsby develop
.Environment
The text was updated successfully, but these errors were encountered: