【问题标题】:ngc not compiling project using not typed third party librariesngc 不使用非类型化第三方库编译项目
【发布时间】:2017-02-15 12:42:50
【问题描述】:

该项目使用未定义类型的第三方库。由于该项目是使用 Angular CLI(版本 1.0.0-beta.29)开发的,因此该库在 typings.d.ts 中声明。在我的例子中:声明模块'xml2js-es6-promise';

项目可以编译并且使用 tsc 可以正常运行,但不能使用 ngc。 错误跟踪:

Cannot find module ‘xml2js-es6-promise’

tscconfig:

{
 “compilerOptions”: {
 “baseUrl”: “.”,
 “declaration”: true,
 “stripInternal”: true,
 “experimentalDecorators”: true,
 “strictNullChecks”: false,
 “noImplicitAny”: false,
 “module”: “es2015”,
 “moduleResolution”: “node”,
 “paths”: {
 “@angular/core”: [“node_modules/@angular/core”],
 “rxjs/*”: [“node_modules/rxjs/*”],
 “xml2js-es6-promise”:[“node_modules/xml2js-es6-promise”]
 },
 “rootDir”: “.”,
 “outDir”: “dist”,
 “sourceMap”: true,
 “inlineSources”: true,
 “target”: “es5”,
 “skipLibCheck”: true,
 “lib”: [
 “es2015”, 
 “dom”
 ]
 },
 “files”: [
 “index.ts”
 ],
 “angularCompilerOptions”: {
 “strictMetadataEmit”: true
 }
}

【问题讨论】:

    标签: angular angular2-aot


    【解决方案1】:

    第三方库应包含 ngc 编译 (aot) 时生成的 ngsummary.json 文件。否则你无法提前编译你的项目。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2012-04-14
      • 2012-11-19
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-02-18
      相关资源
      最近更新 更多