Skip to content

Gatsby build fails  #16

@bbrinx

Description

@bbrinx

When deploying a Gatsby app with the react-slidez, the build fails due to a window is not defined error. As far as I know this could fixed as simple as this:

// Wrap the require in check for window
if (typeof window !== `undefined`) {
  const module = require("module")
}

-------------Netlify Output-------------

7:51:04 PM: error Building static HTML failed
7:51:04 PM: See our docs page on debugging HTML builds for help https://gatsby.dev/debug-html
7:51:04 PM:   500 | 	// to operate correctly into non-standard environments
7:51:04 PM:   501 | 	// @see https://github.com/webpack-contrib/style-loader/issues/177
7:51:04 PM: > 502 | 	return window && document && document.all && !window.atob;
7:51:04 PM:       | ^
7:51:04 PM:   503 | });
7:51:04 PM:   504 |
7:51:04 PM:   505 | var getElement = (function (fn) {
7:51:04 PM: 
7:51:04 PM:   WebpackError: ReferenceError: window is not defined
7:51:04 PM:   
7:51:04 PM:   - index.js:502 
7:51:04 PM:     [lib]/[react-slidez]/build/index.js:502:1
7:51:04 PM:   
7:51:04 PM:   - index.js:491 
7:51:04 PM:     [lib]/[react-slidez]/build/index.js:491:1
7:51:04 PM:   
7:51:04 PM:   - index.js:536 ./node_modules/react-slidez/build/index.js.module.exports.modul    e.exports [as exports]
7:51:04 PM:     [lib]/[react-slidez]/build/index.js:536:1
7:51:04 PM:   
7:51:04 PM:   - index.js:85 Object.<anonymous>
7:51:04 PM:     [lib]/[react-slidez]/build/index.js:85:1
7:51:04 PM:   
7:51:04 PM:   - index.js:21 __webpack_require__
7:51:04 PM:     [lib]/[react-slidez]/build/index.js:21:1
7:51:04 PM:   
7:51:04 PM:   - index.js:122 Object../node_modules/react-slidez/build/index.js.module.export    s.Object.defineProperty.value
7:51:04 PM:     [lib]/[react-slidez]/build/index.js:122:1
7:51:04 PM:   
7:51:04 PM:   - index.js:21 __webpack_require__
7:51:04 PM:     [lib]/[react-slidez]/build/index.js:21:1
7:51:04 PM:   
7:51:04 PM:   - index.js:160 Object.<anonymous>
7:51:04 PM:     [lib]/[react-slidez]/build/index.js:160:1
7:51:04 PM:   
7:51:04 PM:   - index.js:21 __webpack_require__
7:51:04 PM:     [lib]/[react-slidez]/build/index.js:21:1
7:51:04 PM:   
7:51:04 PM:   - index.js:67 
7:51:04 PM:     [lib]/[react-slidez]/build/index.js:67:1
7:51:04 PM:   
7:51:04 PM:   - index.js:70 Object../node_modules/react-slidez/build/index.js
7:51:04 PM:     [lib]/[react-slidez]/build/index.js:70:1
7:51:04 PM:   
7:51:04 PM:   - bootstrap:19 __webpack_require__
7:51:04 PM:     lib/webpack/bootstrap:19:1
7:51:04 PM:   
7:51:04 PM:   - border.js:1 Module../src/pages/border.js
7:51:04 PM:     lib/src/pages/border.js:1:1
7:51:04 PM:   
7:51:04 PM:   - bootstrap:19 __webpack_require__
7:51:04 PM:     lib/webpack/bootstrap:19:1
7:51:04 PM:   
7:51:04 PM:   - sync-requires.js:10 Object../.cache/sync-requires.js
7:51:04 PM:     lib/.cache/sync-requires.js:10:56
7:51:04 PM:   
7:51:04 PM:   - bootstrap:19 __webpack_require__
7:51:04 PM:     lib/webpack/bootstrap:19:1

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