问题类型:错误/问题
描述
我正在使用ng-packagr lib将我的库编译为js.我编译了所有内容没有任何问题,但是当我想要使用ng build --prod(启用AOT)来使用我的库时,我收到错误:
ERROR in Error during template compile of 'AppModule' Function calls are not supported in decorators but 'BsDropdownModule' was called.
当我删除.forRoot方法时,我收到错误:
ERROR in : Unexpected value 'BsDropdownModule in /home/sf/Desktop/Developerka/kompilacja/final/sample-repo/node_modules/angular-library-name/free/dropdown/dropdown.module.d.ts' imported by the module 'AppModule in /home/sf/Desktop/Developerka/kompilacja/final/sample-repo/src/app/app.module.ts'. Please add a @NgModule annotation
请注意,这ng --prod --aot=false
不会产生任何错误.
如何重现:
下载repo:https://github.com/Bloodcast69/aot-error,输入
npm install
ng build --prod.
预期的行为
想要使用AOT构建没有错误(我需要它与Angular Universal兼容)版本信息
ng-packagr: 2.4.1
@angular/*: 5.2.9
typescript: 2.5.3
rxjs: 5.5.6
node: 8.1.0
npm/yarn: npm: 5.6.0
文件:
app.module.ts: …
typescript angular-universal angular2-aot angular ng-packagr
有人知道,Angular6中的Renderer3是否会与Angular5向后兼容?在我们的库中,我们使用Renderer2,我们想知道Renderer3是否会与Angular 5向后兼容。