这可以防止在我运行ng服务时删除我的outDir...直接在终端窗口中的可视化代码编辑器中:
ng serve --deleteOutputPath=false
但是当我想在 package.json 中配置此调用时:
"scripts": {
"ng": "ng",
"start": "ng serve --deleteOutputPath=false",
"build": "ng build",
},
然后运行
ng serve
在终端窗口中,则删除 outDir!
为什么?
要运行 npm start
脚本,您需要运行 npm start
或 npm run start
。
此外,如果您不希望删除项目的输出目录(包括生成和服务(,则可以在项目中运行ng set defaults.build.deleteOutputPath false
。 使用公用线路选项将覆盖配置的默认值。