0

我创建了一个 Angular 库。我正在使用 ng-packagr 来构建库。当我使用 ng-packagr 构建库时,它会在 public_api.ts 文件所在的目录中为 AOT 创建 .metada.json。

我们可以将 .metdata.json 生成的目录更改为“dist”文件夹内吗?

ng-package.json

{
  "$schema": "./node_modules/ng-packagr/ng-package.schema.json",
  "lib": {
    "entryFile": "public_api.ts",
    "languageLevel": [
      "dom",
      "es2017"
    ]
  },
  "whitelistedNonPeerDependencies": [
    "@angular/*",
    "core-js",
    "rxjs",
    "zone.js",
    "moment",
    "aws-sdk"
  ]
}

tsconfig.json

{
  "compileOnSave": false,
  "compilerOptions": {
    "baseUrl": ".",
    "emitDecoratorMetadata": true,
    "experimentalDecorators": true,
    "module": "commonjs",
    "moduleResolution": "node",
    "rootDir": ".",
    "outDir": "./dist/out-tsc",
    "sourceMap": true,
    "inlineSources": true,
    "skipLibCheck": true,
    "noImplicitAny": false,
    "declaration": false,
    "target": "es5",
    "lib": [
      "es7",
      "dom"
    ],
    "typeRoots": [
      "node_modules/@types"
    ],
    "types": [
      "node",
      "jasmine"
    ]
  },
  "angularCompilerOptions": {
    "skipTemplateCodegen": true,
    "strictMetadataEmit": true,
    "fullTemplateTypeCheck": true
  },
  "exclude": [
    "node_modules"
  ]
}
4

1 回答 1

1

如果您从一开始就创建这个项目并使用最新的 Angular 版本甚至 Angular 版本 5,那么我建议您使用 Nx Workspace。

它使这个角度包创建过程非常简单,

于 2018-10-10T05:49:19.110 回答