MoonMail-UI 无法使用 reactjs / webpack 正确构建
Posted
技术标签:
【中文标题】MoonMail-UI 无法使用 reactjs / webpack 正确构建【英文标题】:MoonMail-UI cannot build properly using reactjs / web-pack 【发布时间】:2017-07-19 18:48:48 【问题描述】:节点-v:v.4.4.5
npm -v: 4.3.0
操作系统:Windows 10
重现问题的步骤:
-
git clone git@github.com:microapps/MoonMail-UI.git
cd moonmail-ui
npm 安装
npm 构建
...发生错误...
./src/styles/core.scss 中的错误 模块构建失败:ReferenceError: self is not defined
at C:\dev\test-project\node_modules\style-loader\index.js!C:\dev\test-project\node_modules\css-loader\index.js?sourceMap&-minimize&modules&importLoaders=
1&localIdentName=[name][local][hash:base64:5]!C:\dev\test-project\node_modules\postcss-loader\index.js!C:\dev\测试项目\node_modules\sass-loader\index .js?sourceMap!C:\dev\test-project\src\styles\core.scss:99:30
at C:\dev\test-project\node_modules\style-loader\index.js!C:\dev\test-project\node_modules\css-loader\index.js?sourceMap&-minimize&modules&importLoaders=
1&localIdentName=[name][local][hash:base64:5]!C:\dev\test-project\node_modules\postcss-loader\index.js!C:\dev\测试项目\node_modules\sass-loader\index .js?sourceMap!C:\dev\test-project\src\styles\core.scss:94:47
at module.exports (C:\dev\test-project\node_modules\style-loader\index.js!C:\dev\test-project\node_modules\css-loader\index.js?sourceMap&-minimize&module
s&importLoaders=1&localIdentName=[name][local][hash:base64:5]!C:\dev\test-project\node_modules\postcss-loader\index.js!C:\开发\测试项目\node_modules\s ass-loader\index.js?sourceMap!C:\dev\test-project\src\styles\core.scss:116:68)
at Object.<anonymous> (C:\dev\test-project\node_modules\style-loader\index.js!C:\dev\test-project\node_modules\css-loader\index.js?sourceMap&-minimize&mo
dules&importLoaders=1&localIdentName=[name][local][hash:base64:5]!C:\dev\test-project\node_modules\postcss-loader\index.js!C:\开发\测试项目\节点模块 es\sass-loader\index.js?sourceMap!C:\dev\test-project\src\styles\core.scss:400:36)
at __webpack_require__ (C:\dev\test-project\node_modules\style-loader\index.js!C:\dev\test-project\node_modules\css-loader\index.js?sourceMap&-minimize&m
odules&importLoaders=1&localIdentName=[name][local][hash:base64:5]!C:\dev\test-project\node_modules\postcss-loader\index.js!C:\开发\测试项目\node_modu les\sass-loader\index.js?sourceMap!C:\dev\test-project\src\styles\core.scss:21:30)
at C:\dev\test-project\node_modules\style-loader\index.js!C:\dev\test-project\node_modules\css-loader\index.js?sourceMap&-minimize&modules&importLoaders=
1&localIdentName=[name][local][hash:base64:5]!C:\dev\test-project\node_modules\postcss-loader\index.js!C:\dev\测试项目\node_modules\sass-loader\index .js?sourceMap!C:\dev\test-project\src\styles\core.scss:65:18
at Object.<anonymous> (C:\dev\test-project\node_modules\style-loader\index.js!C:\dev\test-project\node_modules\css-loader\index.js?sourceMap&-minimize&mo
dules&importLoaders=1&localIdentName=[name][local][hash:base64:5]!C:\dev\test-project\node_modules\postcss-loader\index.js!C:\开发\测试项目\节点模块 es\sass-loader\index.js?sourceMap!C:\dev\test-project\src\styles\core.scss:68:10)
at Module._compile (module.js:409:26) at Object.loaderContext.exec (C:\dev\test-project\node_modules\webpack\lib\NormalModule.js:94:6) at Object.<anonymous> (C:\dev\test-project\node_modules\extract-text-webpack-plugin\loader.js:112:21) at Compiler.<anonymous> (C:\dev\test-project\node_modules\webpack\lib\Compiler.js:251:10) at C:\dev\test-project\node_modules\webpack\lib\Compiler.js:442:12 at next (C:\dev\test-project\node_modules\tapable\lib\Tapable.js:138:11) at Compiler.<anonymous> (C:\dev\test-project\node_modules\extract-text-webpack-plugin\loader.js:93:4) at next (C:\dev\test-project\node_modules\tapable\lib\Tapable.js:140:14) at Compiler.<anonymous> (C:\dev\test-project\node_modules\webpack\lib\CachePlugin.js:61:4) at Compiler.applyPluginsAsyncSeries (C:\dev\test-project\node_modules\tapable\lib\Tapable.js:142:13) at Compiler.<anonymous> (C:\dev\test-project\node_modules\webpack\lib\Compiler.js:439:9) at Compilation.applyPluginsAsyncSeries (C:\dev\test-project\node_modules\tapable\lib\Tapable.js:131:46) at Compilation.<anonymous> (C:\dev\test-project\node_modules\webpack\lib\Compilation.js:621:18) at Compilation.applyPluginsAsyncSeries (C:\dev\test-project\node_modules\tapable\lib\Tapable.js:131:46) at Compilation.<anonymous> (C:\dev\test-project\node_modules\webpack\lib\Compilation.js:612:10) at next (C:\dev\test-project\node_modules\tapable\lib\Tapable.js:138:11) at Compilation.<anonymous> (C:\dev\test-project\node_modules\webpack\lib\optimize\UglifyJsPlugin.js:144:4) at Compilation.applyPluginsAsyncSeries (C:\dev\test-project\node_modules\tapable\lib\Tapable.js:142:13) at Compilation.<anonymous> (C:\dev\test-project\node_modules\webpack\lib\Compilation.js:607:9) at Compilation.applyPluginsAsyncSeries (C:\dev\test-project\node_modules\tapable\lib\Tapable.js:131:46) at Compilation.<anonymous> (C:\dev\test-project\node_modules\webpack\lib\Compilation.js:603:8) at Compilation.applyPluginsAsyncSeries (C:\dev\test-project\node_modules\tapable\lib\Tapable.js:131:46) at Compilation.seal (C:\dev\test-project\node_modules\webpack\lib\Compilation.js:551:7)
我也无法npm start
或npm run start:prod
【问题讨论】:
【参考方案1】:我们已更新 MoonMail-UI 以使用最新的 webpack 版本以及一些代码清理和改进。请拉出最后的更改,删除node_modules
文件夹,如果有的话,然后运行npm install
【讨论】:
以上是关于MoonMail-UI 无法使用 reactjs / webpack 正确构建的主要内容,如果未能解决你的问题,请参考以下文章
无法使用 ReactJs、Axios、Redux 渲染/显示从 api 获取的数据
ReactJS:TypeError:无法添加/删除密封数组元素