如何在 angular 8 中停止差分构建?
how to stop differential build in angular 8?
是否有任何选项可以阻止 angular 8 的新功能为旧浏览器划分包?因为构建需要双倍的时间,非常长。
查看 differential build/loading 上的文档:
The Angular CLI handles differential loading for you as part of the
build process for deployment. The ng build command produces the
necessary bundles used for differential loading, based on your browser
support requirements and compilation target.
The Angular CLI uses two configurations for differential loading:
Browsers list The browserslist configuration file is included in your application project structure and provides the minimum browsers
your application supports. See the Browserslist spec for complete
configuration options.
TypeScript configuration In the TypeScript configuration file, tsconfig.json, the target in the compilerOptions section determines
the ECMAScript target version that the code is compiled to. Modern
browsers support ES2015 natively, while ES5 is more commonly used to
support legacy browsers.
By default, legacy browsers such as IE 9-11 are ignored, and the
compilation target is ES2015. As a result, this produces two builds,
and differential loading is enabled. If you ignore browsers without
ES2015 support, a single build is produced.
还有一节到opt out:
Opting out of differential loading
Differential loading can be explicitly disabled if it causes
unexpected issues or you need to target ES5 specifically for legacy
browser support.
To explicitly disable differential loading:
Enable the dead or IE browsers in the browserslist config file by removing the not keyword in front of them.
Set the target in the compilerOptions to es5.
您可以简单地从 es2015 切换回 es5 作为您 tsconfig.json 中的编译目标。
"compilerOptions": {
...
"target":"es5",
...
}
是否有任何选项可以阻止 angular 8 的新功能为旧浏览器划分包?因为构建需要双倍的时间,非常长。
查看 differential build/loading 上的文档:
The Angular CLI handles differential loading for you as part of the build process for deployment. The ng build command produces the necessary bundles used for differential loading, based on your browser support requirements and compilation target.
The Angular CLI uses two configurations for differential loading:
Browsers list The browserslist configuration file is included in your application project structure and provides the minimum browsers your application supports. See the Browserslist spec for complete configuration options.
TypeScript configuration In the TypeScript configuration file, tsconfig.json, the target in the compilerOptions section determines the ECMAScript target version that the code is compiled to. Modern browsers support ES2015 natively, while ES5 is more commonly used to support legacy browsers.
By default, legacy browsers such as IE 9-11 are ignored, and the compilation target is ES2015. As a result, this produces two builds, and differential loading is enabled. If you ignore browsers without ES2015 support, a single build is produced.
还有一节到opt out:
Opting out of differential loading
Differential loading can be explicitly disabled if it causes unexpected issues or you need to target ES5 specifically for legacy browser support.
To explicitly disable differential loading:
Enable the dead or IE browsers in the browserslist config file by removing the not keyword in front of them. Set the target in the compilerOptions to es5.
您可以简单地从 es2015 切换回 es5 作为您 tsconfig.json 中的编译目标。
"compilerOptions": {
...
"target":"es5",
...
}