简体   繁体   English

AngularCli预配置的构建参数

[英]AngularCli Preconfigured build parameters

In an AngularCli project, there is the command ng build which works fine in a dev environment, but for release I need a few extra options like 在AngularCli项目中,有一个ng build命令可以在开发环境中正常工作,但是要发布,我需要一些其他选项,例如

ng build -prod --base-href /serversubfolder/ -aot

Is there any way to add a sub script to angular cli so I can make a shorter command so I don't have to remember all these parameters. 有什么方法可以将一个子脚本添加到angular cli中,所以我可以做一个更短的命令,所以我不必记住所有这些参数。 Ie

ng build-release

Which would be equivalent to the first statement? 哪一个等同于第一条陈述? or am I stuck making a batch file for now? 还是我现在暂不制作批处理文件?

Configure in your package.json file. 在您的package.json文件中进行配置。

 "scripts": {
    "release":"ng build -prod --base-href /serversubfolder/ --aot"
  },

now you need enter 现在您需要输入

npm run release

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM