【发布时间】:2021-06-27 04:00:38
【问题描述】:
我的 Gatsby with Sanity 应用程序在运行 npm run build 时收到以下错误:
WebpackError: ReferenceError: window is not defined (from plugin: gatsby-plugi
n-styled-components)
似乎是外部包gatsby-plugin-styled-components 在某处使用window。我尝试用此处描述的虚拟模块替换https://www.gatsbyjs.com/docs/debugging-html-builds/#fixing-third-party-modules,但我的样式组件不起作用,所以它不是解决方案.
也许我在不支持的地方使用了样式化组件技术?我查看了不同的 gatsby/styled components 示例 repo,但找不到区别。
你可以在这里找到回购:https://github.com/sanderdebr/sanity-gatsby-portfolio
【问题讨论】:
标签: gatsby styled-components sanity