为什么即使我的 .browserlistrc 仅针对 "last 1 chrome version",也会创建 polyfill.js 文件?

Why is a polyfill.js file being created even when my .browserlistrc only targets "last 1 chrome version"?

这是新 Angular (v10) 应用程序的构建图像。

这里是 tsconfig.base.json:

 {
    "compileOnSave": false,
      "compilerOptions": {
        "baseUrl": "./",
        "outDir": "./dist/out-tsc",
        "sourceMap": true,
        "declaration": false,
        "downlevelIteration": false,
        "experimentalDecorators": true,
        "moduleResolution": "node",
        "importHelpers": true,
        "target": "es2020",
        "module": "es2020",
        "lib": ["es2020", "dom"]
      },
      "angularCompilerOptions": {
        "strictInjectionParameters": true,
        "strictTemplates": true
      }
    }

这里是.browserlistrc文件的内容:

last 1 Chrome version

我的问题是:为什么会有polyfills.js文件?难道我的目标是最新的 ES 版本以及最新的 Chrome 版本就不需要任何 polyfill 了吗?还是我误解了该类型文件的用途?

深入研究 polyfills.js 的实际输出并试验删除它时会发生什么,我发现 Angular“区域”功能是通过该文件提供的。

例如,如果我删除 polyfills.js 脚本导入语句,则会出现此错误:

if (this.hasPendingMacrotasks = !1,
    this.hasPendingMicrotasks = !1,
    this.isStable = !0,
    this.onUnstable = new Hs(!1),
    this.onMicrotaskEmpty = new Hs(!1),
    this.onStable = new Hs(!1),
    this.onError = new Hs(!1),
    "undefined" == typeof Zone)
    throw new Error("In this configuration Angular requires Zone.js");
            https://angular.io/guide/zone#setting-up-zonejs

进一步挖掘,我发现所有这些甚至都在 Angular documentation on Zones 中,也是一个未注释掉的行 polyfills.ts:

import 'zone.js/dist/zone'; 

所以,TLDR;只要您在 Angular 应用程序中使用 Zones(并且有删除它的方法),您将始终有一个 polyfills.js 文件作为构建输出的一部分。