今天差點沒有坑死我,package.json裏面html
而後我打包解決element-ui的轉譯問題時,發現node_modules裏面node
被坑的個人心都死了,不過還好最後是解決了webpack
module: { ... { test: /\.js$/, loader: 'babel-loader',//注意elementUI的源碼使用ES6須要解析 include: [resolve('src'), resolve('test'),resolve('/node_modules/_element-ui@1.4.10@element-ui/src'),resolve('/node_modules/_element-ui@1.4.10@element-ui/packages')] }, ...
npm run build 後web
ERROR in static/js/0.0143a4d9ad92d5c7f658.js from UglifyJs
Unexpected token: punc (() [./~/_element-ui@1.4.10@element-ui/packages/row/src/r
ow.js:24,0][static/js/0.0143a4d9ad92d5c7f658.js:524,9]
ERROR in static/js/1.c6586324bf2fd251ec7b.js from UglifyJs
Unexpected token: punc (() [./~/_element-ui@1.4.10@element-ui/packages/row/src/r
ow.js:24,0][static/js/1.c6586324bf2fd251ec7b.js:539,9]
ERROR in static/js/2.2b7b58156258c88e9cdf.js from UglifyJs
Unexpected token: punc (() [./~/_element-ui@1.4.10@element-ui/packages/row/src/r
ow.js:24,0][static/js/2.2b7b58156258c88e9cdf.js:539,9]
ERROR in static/js/8.48d0e6b7d1466b2cb224.js from UglifyJs
Unexpected token: operator (>) [./~/_element-ui@1.4.10@element-ui/src/mixins/emi
tter.js:2,0][static/js/8.48d0e6b7d1466b2cb224.js:89,32]
UglifyJs 通常是 沒法解析ES6的問題,在1.4.10 element-ui的包裏看來是有ES6的語法了npm
在build文件夾的 webpack.base.conf.jselement-ui
看到它,內心安定多了json