问题描述
我已经在互联网上进行了出色的搜索,无法解决此问题。
我正在使用Gasby开发静态页面,并且遇到此错误:
WebpackError: ReferenceError: window is not defined
我的线索是,这与我使用的bootsrap / Modal模块有关。但是我已经清理了所有index.js并在尝试构建它时仍然出现错误。
//index.js
import React from 'react'
const IndexPage = () => (
<div>
</div>
)
export default IndexPage
有人知道我该如何解决吗?谢谢!
Ps:我已经尝试在componentDidMount上导入引导程序模块,也尝试设置gatsby-node.js,并且还尝试导入具有可加载组件的引导程序模块。
Edit1:来自gatsby-config.js的插件部分
plugins: [
`gatsby-plugin-react-helmet`,{
resolve: `gatsby-source-filesystem`,options: {
name: `images`,path: `${__dirname}/src/images`,},`gatsby-transformer-sharp`,`gatsby-plugin-sharp`,{
resolve: `gatsby-plugin-manifest`,options: {
name: `ayo`,short_name: `ayo`,start_url: `/`,background_color: `#fff`,theme_color: `#20336C`,display: `minimal-ui`,icon: `src/images/icon.png`,// This path is relative to the root of the site.
},// this (optional) plugin enables Progressive Web App + Offline functionality
// To learn more,visit: https://gatsby.dev/offline
// `gatsby-plugin-offline`,
],
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)