2017-02-15 67 views
0

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

项目编译和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 
 } 
} 

回答

0

的第三方库应包括生产的ngsummary.json文件,而NGC编译(AOT)。否则,你无法提前编译你的项目。