生产物业在环境中有什么作用?

发布于 2025-01-30 02:16:49 字数 228 浏览 2 评论 0原文

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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

暗喜 2025-02-06 02:16:49

生产属性就在那里,以便您可以查看环境。生产并在错误时编写调试代码。除非您拥有检查该标志的代码,否则它不会对您的构建或代码产生任何影响。通常,您的环境文件更多是可以用于自己的用例的配置文件。根据您的构建参数和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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文