生产物业在环境中有什么作用?
在Angular
项目的环境文件中,当生产
属性设置为true
vs时会发生什么事。 >?
我们有多个产品环境文件 - 每个文件都用于不同的区域。我注意到他们的生产之一
属性设置为false
,即使它是一个产品环境文件。这是否会使二进制文件更大,除其他不良产品外,还可以使二进制型制造吗?
In an Angular
project's environment files, what happens when the production
property is set to true
vs when it's set to false
?
We have multiple prod environment files - each is used for a different region. I noticed one of their production
properties is set to false
, even though it's a prod environment file. Does this make the binaries larger, among other bad stuff for prod builds?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
生产属性就在那里,以便您可以查看环境。生产并在错误时编写调试代码。除非您拥有检查该标志的代码,否则它不会对您的构建或代码产生任何影响。通常,您的环境文件更多是可以用于自己的用例的配置文件。根据您的构建参数和Angular.json文件中的配置,Angular选择了不同的环境文件。
检查一下: https://angular.io/guide/build/build 配置特定于目标的文件替换部分。
基本上,如果您有一个环境。架构。
The production property is just there so that you can look at environment.production and write debug code when it is false. It will not have any affect on your build or code unless you have lines your code that check for that flag. Your environment file in general is more of a config file that you can use for your own use cases. Angular picks a different environment file based on your build parameters and your configurations in your angular.json file.
check this out: https://angular.io/guide/build and also take a look at the Configure target-specific file replacements section.
Basically if you have a environment.staging.ts and a configuration for staging in your angular.json file, you can run ng build --configuration=staging to use those variables for that build.