You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
直接npm run build会报错如下:
ERROR in static/js/0.94510c9d26edb4b687ab.js from UglifyJs
Unexpected token: punc (() [./~/time-formater/lib/timeformater.js:21,0][static/js/0.94510c9d26edb4b687ab.js:41797,10]
直接npm run build会报错如下:
ERROR in static/js/0.94510c9d26edb4b687ab.js from UglifyJs
Unexpected token: punc (() [./~/time-formater/lib/timeformater.js:21,0][static/js/0.94510c9d26edb4b687ab.js:41797,10]
主要问题是UglifyJs压缩代码的时候,无法压缩ES6的代码,要先用bable转化为ES5.
time-formater这个库是ES6的,并且没有被转化。
解决方式:
npm install --save--dev babel-preset-es2015@6.24.1
在webpack.base.conf下,把
include: [resolve('src'), resolve('test')] 修改为
include: [resolve('src'), resolve('test'),resolve('node_modules/time-formater')]
index.html引用js.css路径不对的问题,在config/index.js中
设置成assetsPublicPath: './',
The text was updated successfully, but these errors were encountered: