我想在 VMware 的清晰框架上构建一个带有一些自定义组件的 Angular 库项目。
运行ng build --prod draft
应该产生一个库输出。
相反,我得到:
构建错误:draft/node_modules/@clr/angular/clr-angular.d.ts 中的模块“ClrFormsNextModule”导出的意外值“未定义”
错误::draft/node_modules/@clr/angular/clr-angular.d.ts 中的模块“ClrFormsNextModule”导出的意外值“未定义”
at Object.<anonymous> (draft/node_modules/ng-packagr/lib/ngc/compile-source-files.js:53:68) at Generator.next (<anonymous>) at draft/node_modules/ng-packagr/lib/ngc/compile-source-files.js:7:71 at new Promise (<anonymous>) at __awaiter (draft/node_modules/ng-packagr/lib/ngc/compile-source-files.js:3:12) at Object.compileSourceFiles (draft/node_modules/ng-packagr/lib/ngc/compile-source-files.js:19:12) at Object.<anonymous> (draft/node_modules/ng-packagr/lib/ng-v5/entry-point/ts/compile-ngc.transform.js:26:32) at Generator.next (<anonymous>) at draft/node_modules/ng-packagr/lib/ng-v5/entry-point/ts/compile-ngc.transform.js:7:71 at new Promise (<anonymous>)
这是package.json
库项目的文件
{
"name": "draft",
"version": "0.0.1",
"peerDependencies": {
"@angular/common": "^6.0.0-rc.0 || ^6.0.0",
"@angular/core": "^6.0.0-rc.0 || ^6.0.0",
"@clr/angular": "^0.12.0",
"@clr/icons": "^0.12.0",
"@clr/ui": "^0.12.0",
"moment": "^2.22.2",
"rxjs": "^6.0.0",
"rxjs-compat": "^6.2.2",
"@webcomponents/custom-elements": "^1.2.0",
"lodash": "^4.17.10",
"object-fit-images": "^3.2.3"
}
}
里面root/projects/draft/tsconfig.lib.json
{
"extends": "../../tsconfig.json",
"compilerOptions": {
"outDir": "../../out-tsc/lib",
"target": "es2015",
"module": "es2015",
"moduleResolution": "node",
"declaration": true,
"sourceMap": true,
"inlineSources": true,
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"importHelpers": true,
"types": [],
"lib": [
"dom",
"es2015",
"es2017.object"
],
"paths": {
"@angular/*": [
"../node_modules/@angular/*"
],
"@clr/*":[
"../node_modules/@clr/*"
]
}
},
"angularCompilerOptions": {
"annotateForClosureCompiler": true,
"skipTemplateCodegen": true,
"strictMetadataEmit": true,
"fullTemplateTypeCheck": true,
"strictInjectionParameters": true,
"flatModuleId": "AUTOGENERATED",
"flatModuleOutFile": "AUTOGENERATED"
},
"exclude": [
"src/test.ts",
"**/*.spec.ts"
]
}
里面root/projects/draft/src/draft.module
import { ClarityModule } from '@clr/angular';
环境细节
角度版本: 6.0.3
清晰度版本: 0.12.0
操作系统和版本: macOS 10.13.6
浏览器: Chrome 68