首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >ngc不使用非类型化第三方库编译项目

ngc不使用非类型化第三方库编译项目
EN

Stack Overflow用户
提问于 2017-02-15 12:42:50
回答 1查看 187关注 0票数 0

该项目使用没有定义类型的第三方库。由于该项目是使用角CLI (Version1.0.0-beta.29)开发的,库是在typings.d.ts中声明的。在我的例子中:声明模块‘xml2js-ES6-诺言’;

项目编译和服务于tsc,而不是ngc。错误跟踪:

代码语言:javascript
复制
Cannot find module ‘xml2js-es6-promise’

tscconfig:

代码语言:javascript
复制
{
 “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
 }
}
EN

回答 1

Stack Overflow用户

发布于 2017-04-17 05:36:42

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

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/42249760

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档