折腾:
【临时解决】webpack打包失败:ERROR in bundle js from UglifyJs Unexpected token punc
期间,不过发现:
npm install > npm_install_20171024.log
输出的log中,提示:
npm WARN deprecated [email protected]: In 6.x, the babel package has been deprecated in favor of babel-cli. Check https://opencollective.com/babel to support the Babel maintainers npm WARN deprecated [email protected]: 🙌 Thanks for using Babel: we recommend using babel-preset-env now: please read babeljs.io/env to update! |
怀疑之前问题就是babel引起的,所以还是去根据建议去:
把babel-preset-es2015换成babel-preset-env
https://opencollective.com/babel
目前还打不开:Internal Server Error
所以先去看看:
babel-preset-es2015 -> babel-preset-env · Babel
babel/babel-preset-env: Autoprefixer for Babel: compile less (moved)
所以,去换
➜ ucowsapp_h5_en git:(master) ✗ npm install babel-preset-env –save-dev [email protected] /Users/crifan/dev/dev_root/daryun/Projects/xxx/ucowsapp_h5_en |
删除之前的:
“babel-preset-es2015”: “^6.24.0”,
.babelrc中改为:
{ “sourceMaps”: true, “presets”: [ [ “env”, { “loose”: true } ], “stage-0” ], “plugins”: [ [“transform-decorators-legacy”], [“transform-react-jsx”, { “pragma”: “h” }] ] } |
注:
babel-preset-env包括了之前的:
babel-preset-es2015, babel-preset-es2016, babel-preset-es2017
babel-preset-latest
其他社区的es20xx
babel-preset-node5, babel-preset-es2015-node, 等等
先去看看 npm run build是否解决了
结果问题依旧:ERROR in bundle_2e70388dd90039cb3b05.js from UglifyJs
否则待会再去看看那个babel的:
In 6.x, the babel package has been deprecated in favor of babel-cli
Getting weird error – Use the `babel-core` package not `babel`. · Issue #5506 · babel/babel
安装ssmgr的出错信息 · Issue #220 · shadowsocks/shadowsocks-manager
Upgrade to Babel 7 (WIP) · Babel
官网是废了babel v6,建议换用babel-cli,且也不打算发布v7了
[7.0] remove standalone babel package by hzoo · Pull Request #5293 · babel/babel
npmdoc/node-npmdoc-babel – Libraries.io
所以去试试,去掉:
“babel”: “^6.5.2”,
再去:
npm install babel-cli –save-dev
➜ ucowsapp_h5_en git:(master) ✗ npm install babel-cli –save-dev [email protected] /Users/crifan/dev/dev_root/xxx/ucowsapp_h5_en |
【总结】
此处根据提示去把:
babel换为babel-cli
babel-preset-es2015换为babel-preset-env
即可。
转载请注明:在路上 » 【已解决】npm WARN deprecated [email protected] [email protected]