vue系列:vue/cli3配置watch实时代码打包

解决

修改 package.json 增加 watch,然后使用 npm run watch 就可以实时打包了,而且打包后的代码不会压缩代码,速度很快。

"scripts": {
  "serve": "vue-cli-service serve",
  "build": "vue-cli-service build",
  "watch": "vue-cli-service build --watch",
  "test:unit": "vue-cli-service test:unit",
  "test:e2e": "vue-cli-service test:e2e",
  "lint": "vue-cli-service lint"
},

其他选项

查看 vue/cli官方文档

例如:

用法:vue-cli-service build [options] [entry|pattern]

选项:

  --mode        指定环境模式 (默认值:production)
  --dest        指定输出目录 (默认值:dist)
  --modern      面向现代浏览器带自动回退地构建应用
  --target      app | lib | wc | wc-async (默认值:app)
  --name        库或 Web Components 模式下的名字 (默认值:package.json 中的 "name" 字段或入口文件名)
  --no-clean    在构建项目之前不清除目标目录
  --report      生成 report.html 以帮助分析包内容
  --report-json 生成 report.json 以帮助分析包内容
  --watch       监听文件变化
发布了165 篇原创文章 · 获赞 59 · 访问量 3万+

猜你喜欢

转载自blog.csdn.net/weixin_43972437/article/details/103526213