webpack3.0基本打包

基础打包

1、在项目根目录,创建一个生产阶段使用的文件
	webpack.config.prod.js
	
2、把开发阶段配置文件中的内容,拷贝到webpack.config.prod.js
	删除掉devServer
	增加output
	
3、在package.json中增加一个生成阶段的scripts
	"build": "webpack --config webpack.config.prod.js --progress"
	
4、切换到项目根目录
	npm run build

压缩打包

压缩bundle.js
	1、对babel进行改造,主要是因为我们的vue-loader已经升级到15.x
	
	2、在plugins中设置为生成环境,并且使用webpack内置的ugulifyjs压缩js

压缩html
	1、找到html-webpack-plugin它的配置
	
	2、https://github.com/kangax/html-minifier#options-quick-reference

猜你喜欢

转载自blog.csdn.net/lert707/article/details/82758902