角6 VSTS天蓝色构建ng构建配置=生产不起作用

时间:2018-08-19 23:16:51

标签: azure azure-devops angular6 azure-pipelines azure-pipelines-build-task

我们已升级到Angular 6,因此我们不得不将ng build env=prod更改为 ng build configuration=production,因为不再使用angular-cli.json。

在本地,ng build configuration=production可以正常工作,并且我在prod中需要的设置在那里。但是,当我们在Azure VSTS中触发构建步骤/任务时,ng build configuration = production不会将dev设置替换为production。

有人遇到吗?你们做了什么来解决这个问题?

1 个答案:

答案 0 :(得分:3)

首先,尝试将语法更改为

ng run [project]:build:production

其中[project]替换为在angular.json的projects对象中指定的项目名称。

例如,如果您的项目名为“ my-app”,请尝试

ng run my-app:build:production

第二,在angular.json中,确保以您期望的方式定义了my-app> architect> build> configuration> production。

第三,请注意,构建的输出将为dist \ [project] \ production(假设您的“ outputPath”为“ dist”)。您需要确保VSTS构建的工件包括这些文件(例如,通过将它们归档到ZIP中,然后将它们复制到$(Build.ArtifactStagingDirectory))。