该项目使用没有定义类型的第三方库。由于该项目是使用角CLI (Version1.0.0-beta.29)开发的,库是在typings.d.ts中声明的。在我的例子中:声明模块‘xml2js-ES6-诺言’;
项目编译和服务于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
}
}发布于 2017-04-17 05:36:42
第三方库应该包括在ngc编译(aot)时生成的ngsummary.json文件。否则,您无法提前编译项目。
https://stackoverflow.com/questions/42249760
复制相似问题