2017-02-15 65 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)。否則,你無法提前編譯你的項目。