MoonMail-UI 无法使用 reactjs/web-pack 正确构建
MoonMail-UI cannot build properly using reactjs / web-pack
node -v: v.4.4.5
npm -v: 4.3.0
os: windows 10
重现问题的步骤:
- git 克隆 git@github.com:microapps/MoonMail-UI.git
- cd moonmail-ui
- npm 安装
- npm build
- ...发生错误...
ERROR in ./src/styles/core.scss
Module build failed: 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\test-project\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\test-project\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:\dev\test-project\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:\dev\test-project\node_modul
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:\dev\test-project\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\test-project\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:\dev\test-project\node_modul
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
我们更新了 MoonMail-UI 以使用最新的 webpack 版本以及一些代码清理和改进。请提取最后的更改,删除 node_modules
文件夹(如果有)和 运行 npm install
node -v: v.4.4.5
npm -v: 4.3.0
os: windows 10
重现问题的步骤:
- git 克隆 git@github.com:microapps/MoonMail-UI.git
- cd moonmail-ui
- npm 安装
- npm build
- ...发生错误...
ERROR in ./src/styles/core.scss
Module build failed: ReferenceError: self is not definedat 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\test-project\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\test-project\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:\dev\test-project\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:\dev\test-project\node_modul 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:\dev\test-project\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\test-project\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:\dev\test-project\node_modul 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
我们更新了 MoonMail-UI 以使用最新的 webpack 版本以及一些代码清理和改进。请提取最后的更改,删除 node_modules
文件夹(如果有)和 运行 npm install