iview-project-3.0下载地址:https://github.com/iview/iview-project
坑1:npm run init会报错
解决方法:(详见github的issue中)
You also do like this:
file: webpack.dev.config.js
change:
fs.write(fd, buf, 0, buf.length, 0, function(err, written, buffer) {});
to
fs.write(fd, buf, 0, 'utf-8', function(err, written, buffer) {});
Function fs.write with Node v10+ callback must be.
坑2:npm run build会报错
https://blog.csdn.net/qq_41725450/article/details/91975325
解决方法:原因应该是项目中用到了ES6的语法而uglify-js在压缩代码时,遇到es6语法就不会压缩并且也会报错。因此需要使用其他插件BabiliPlugin。
//安装插件
npm i babili-webpack-plugin
//webpack.prod.js
const BabiliPlugin=require("babili-webpack-plugin");
...
new BabiliPlugin(),
同时,删掉webpack.prod.js里面的UglifyJsPlugin插件。
坑3:打包完成后,本地打开时空白页
解决方法