Function calls are not supported in decorators while ng build --prod (AOT)
See original GitHub issueType of Issue
[x ] Bug Report
[ ] Feature Request
Description
I’m using your package to build my library to be compiled to js. I’ve compiled everything without any problems, but when I’ll want to consume my library with ng build --prod (AOT enabled), I’m getting error:
ERROR in Error during template compile of 'AppModule' Function calls are not supported in decorators but 'BsDropdownModule' was called.
ng --prod --aot=false won’t produce any errors.
How To Reproduce
Create new project in Angular, create another module, in this module make forRoot method and post there some things, then pack whole package, and consume in second project. In second project import your module and use on it forRoot method.
Or simply: Download repo: https://github.com/Bloodcast69/aot-error , type npm install and ng build --prod.
Expected Behaviour
Want to build with AOT without errors (I need this to be compatible with Angular Universal)
Version Information
$ node_modules/.bin/ng-packagr --version
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
Issue Analytics
- State:
- Created 5 years ago
- Reactions:34
- Comments:26 (12 by maintainers)
Top GitHub Comments
I’ve fixed this. My problem was: I was importing some providers only from folder, not from file directly. For example: This was bad
import { SampleService } from './services'
This is goodimport { SampleService } from './services/sample.service'
Seeing this issue as well, but not for including packages I wrote. Issues are @ngrx/store, @ngrx/effects and TranslateModule. Which all required you to do .forFeature/forChild().
This also all appeared when I upgraded to “ng-packagr”: “2.4.2”, which I also upgraded to angular 6.0.0.rc-3. Few other apps I upgraded and didn’t have an issue so my guess is it’s something with ng-packagr.