vue项目打包前后webpack.config.js和index.html配置

当项目开发完,想使用服务器进行打包测试。webpack.config.js和index.html页面要进行一些简单配置。
进行打包配置:npm run build 打包命令;
配置:webpack.config.js


20190313210642.png

publicPath的路径设置为你项目打包后的输出路径,如publicPath:'/lgas/dist/',
index.html页面


image.png

的src路径应该跟publicPath设置的路径一样。
当打包完成,需要把打包的配置改回原来的配置。要不然本地npm run dev运行项目会报错

你可能感兴趣的:(vue项目打包前后webpack.config.js和index.html配置)