Angular 库未构建为 es5 目标

Angular library not build to es5 target

我有一个 Angular 库,我需要为 es5 构建它以便它可以在 IE 中使用。 我已遵循本指南 https://angular.io/guide/creating-libraries

这是我的文件结构:

tsconfig.lib.json我改成es5:

/* To learn more about this file see: https://angular.io/config/tsconfig. */
{
  "extends": "../../tsconfig.json",
  "compilerOptions": {
    "outDir": "../../out-tsc/libb",
    "target": "es5", // <-- HERE
    "declaration": true,
    "declarationMap": true,
    "inlineSources": true,
    "types": [],
    "lib": [
      "dom",
      "es2018"
    ]
  },
  "angularCompilerOptions": {
    "skipTemplateCodegen": true,
    "strictMetadataEmit": true,
    "enableResourceInlining": true
  },
  "exclude": [
    "src/test.ts",
    "**/*.spec.ts"
  ]
}

angular.json

的片段
 "projects": {
    "my-lib": {
      "projectType": "library",
      "root": "projects/my-lib",
      "sourceRoot": "projects/my-lib/src",
      "prefix": "lib",
      "architect": {
        "build": {
          "builder": "@angular-devkit/build-angular:ng-packagr",
          "options": {
            "tsConfig": "projects/my-lib/tsconfig.lib.json",
            "project": "projects/my-lib/ng-package.json"
          },

ng-package.json

{
  "$schema": "../../node_modules/ng-packagr/ng-package.schema.json",
  "dest": "../../dist/my-lib",
  "lib": {
    "entryFile": "src/public-api.ts"
  }
}

最后我用这个命令构建它:

"build-lib": "ng build --project=my-lib"

我希望发生的是我在 es5 中构建了 mo 库,但它似乎完全忽略了 tsconfig.lib.json。 这是输出:

有人可以帮我解决这个问题吗?

ESM5 和 FESM5 格式已弃用,请参阅此问题: https://github.com/ng-packagr/ng-packagr/issues/1732