GatsbyJS - extract-text-webpack-plugin出错

时间:2017-08-17 19:57:47

标签: node.js reactjs webpack static-site gatsby

我正在使用GatsbyJS创建静态网站,并且在尝试生成生产版本时遇到了一些问题。

当我gatsby develop时,一切正常,但当我尝试gatsby build时,我现在面临以下错误:

/home/coder/Developer/portfolio/node_modules/extract-text-webpack-plugin/index.js:22
            if(c.initial) return;
                ^

TypeError: Cannot read property 'initial' of undefined
    at ExtractTextPlugin.<anonymous> (/home/coder/Developer/portfolio/node_modules/extract-text-webpack-plugin/index.js:22:8)
    at Array.forEach (native)
    at ExtractTextPlugin.mergeNonInitialChunks (/home/coder/Developer/portfolio/node_modules/extract-text-webpack-plugin/index.js:21:16)
    at ExtractTextPlugin.<anonymous> (/home/coder/Developer/portfolio/node_modules/extract-text-webpack-plugin/index.js:275:12)
    at Array.forEach (native)
    at ExtractTextPlugin.<anonymous> (/home/coder/Developer/portfolio/node_modules/extract-text-webpack-plugin/index.js:273:21)
    at /home/coder/Developer/portfolio/node_modules/extract-text-webpack-plugin/node_modules/async/lib/async.js:52:16
    at Object.async.forEachOf.async.eachOf (/home/coder/Developer/portfolio/node_modules/extract-text-webpack-plugin/node_modules/async/lib/async.js:236:30)
    at Object.async.forEach.async.each (/home/coder/Developer/portfolio/node_modules/extract-text-webpack-plugin/node_modules/async/lib/async.js:209:22)
    at ExtractTextPlugin.<anonymous> (/home/coder/Developer/portfolio/node_modules/extract-text-webpack-plugin/index.js:237:10)
    at Compilation.applyPluginsAsync (/home/coder/Developer/portfolio/node_modules/tapable/lib/Tapable.js:71:13)
    at Compilation.seal (/home/coder/Developer/portfolio/node_modules/webpack/lib/Compilation.js:525:7)
    at Compiler.<anonymous> (/home/coder/Developer/portfolio/node_modules/webpack/lib/Compiler.js:397:15)
    at /home/coder/Developer/portfolio/node_modules/tapable/lib/Tapable.js:103:11
    at Compilation.<anonymous> (/home/coder/Developer/portfolio/node_modules/webpack/lib/Compilation.js:445:10)
    at /home/coder/Developer/portfolio/node_modules/webpack/lib/Compilation.js:417:12

如果我发布了太多信息或者可以提高问题的质量,请告诉我。我希望尽可能具体。
谢谢你的帮助!

1 个答案:

答案 0 :(得分:0)

对于那些到达此页面寻找答案的人:此问题是由文件夹“pages”中的页面之外的任何内容引起的。将样式化和共享组件移动到根目录解决了这个问题。