Vue项目打包简易步骤

VUE

- 在项目中输入命令进行打包

npm run build

创建一个vue.config.js文件(放在最外层)

在这里插入图片描述

  • 在里面配置
module.exports = {
    
    
  lintOnSave: false,
  publicPath:"./"
}
  • 可以在dist的 index.html 中通过 如下 强制隐藏控制台的打印信息
<script>
		console.log = function(){
    
    

		}
</script>
  • 打开dist文件中的index.html文件就好嘞

如果还是有报错
删除 node_modules 文件夹
重新通过npm i 下载依赖
npm run build打包即可

猜你喜欢

转载自blog.csdn.net/weixin_48661063/article/details/115360047