gatsby build showing "WebpackError: ReferenceError: document is not defined" even after adding gatsby-node.js #39024
Labels
status: triage needed
Issue or pull request that need to be triaged and assigned to a reviewer
type: bug
An issue or pull request relating to a bug in Gatsby
type: documentation
An issue or pull request for improving or updating Gatsby's documentation
Preliminary Checks
Description
I think there's some issue with Mantine & Gatsby when used together.
command gatsby build shows this error :
` ERROR #95312 HTML.COMPILATION
"document" is not available during server-side rendering. Enable "DEV_SSR" to debug this during "gatsby develop".
See our docs page for more info on this error: https://gatsby.dev/debug-html
25 | colorSchemeManager = localStorageColorSchemeManager(),
26 | defaultColorScheme = "light",
WebpackError: ReferenceError: document is not defined`
After reading the docs(https://www.gatsbyjs.com/docs/debugging-html-builds/), I added gatsby-node.js to the root of project(which I think ignores the Mantine modules) but no luck.
This is gatsby-node.js file :
exports.onCreateWebpackConfig = ({ stage, loaders, actions }) => { if (stage === "build-html" || stage === "develop-html") { actions.setWebpackConfig({ module: { rules: [ { test: /bad-module/, use: loaders.null(), }, ], }, }) } }
Reproduction Link
https://github.com/neeramrutia/gatsby-youtube-video-downloader
Steps to Reproduce
1.This issue is generated when mantine is used with gatsby
Expected Result
The gatsby build should work
Actual Result
gatsby build stills showing the same error :
ERROR #95312 HTML.COMPILATION
"document" is not available during server-side rendering. Enable "DEV_SSR" to debug this during "gatsby develop".
See our docs page for more info on this error: https://gatsby.dev/debug-html
25 | colorSchemeManager = localStorageColorSchemeManager(),
26 | defaultColorScheme = "light",
WebpackError: ReferenceError: document is not defined
Environment
Config Flags
DEV_SSR:true
The text was updated successfully, but these errors were encountered: