随笔 - 242  文章 - 2  评论 - 7  阅读 - 19万 

安装 npm install concurrently --save-dev

"concurrently": "^7.3.0",

concurrently支持开启多个服务,如下示例中执行npm run dev或者npm run all,则可以同时执行多个npm运行指令。

"scripts": {
    "build": "vue-cli-service build",
    "serve": "vue-cli-service serve",
    "lint": "vue-cli-service lint",
    "report": "vue-cli-service build --report",
    "koa": "node ./koa/abs.js",
    "dev": "concurrently \"npm run koa\" \"npm run serve\""
},
或
"scripts": {
    "dev": "node app.js",
    "start": "node index.js",
    "all": "concurrently \"npm run dev\" \"npm start\""
},

支持多个打包程序服务一起进行的方式,使用&& 合并多个npm运行命令,执行 npm run build:all则得到lib-index和lib-login两个打包文件。

"scripts": {
    "dev": "vue-cli-service serve",
    "build": "vue-cli-service build",  
    "lib": "vue-cli-service build --target lib --name lib-index --dest lib-index ./src/index.js",
    "lib:login": "vue-cli-service build --target lib --name lib-login --dest lib-login ./src/login.js",
    "build:all": "npm run lib && npm run lib:login",
},
posted on   羽丫头不乖  阅读(284)  评论(0编辑  收藏  举报
相关博文:
阅读排行:
· CSnakes vs Python.NET:高效嵌入与灵活互通的跨语言方案对比
· DeepSeek “源神”启动!「GitHub 热点速览」
· 我与微信审核的“相爱相杀”看个人小程序副业
· Plotly.NET 一个为 .NET 打造的强大开源交互式图表库
· 上周热点回顾(2.17-2.23)
点击右上角即可分享
微信分享提示