Error during template compile, function calls are not supported in decorators.
See original GitHub issueType of Issue
[X] Bug Report
[ ] Feature Request
Description
One of my libraries dependencies requires a .forRoot() call to declare the module with providers.
I am including this Module.forRoot() in my module and it works fine, however running packagr for the project fails on compilation.
How To Reproduce
import { DeviceDetectorModule } from 'ngx-device-detector';
@NgModule({
imports: [
DeviceDetectorModule.forRoot(),
],
...
}
BUILD ERROR
Error during template compile of 'EasyGridModule'
Function calls are not supported in decorators but 'DeviceDetectorModule' was called.
Error: Error during template compile of 'EasyGridModule'
Function calls are not supported in decorators but 'DeviceDetectorModule' was called.
at Object.<anonymous> (C:\Users\Tyler\Documents\GitHub\@ngx-easy\node_modules\ng-packagr\lib\ngc\compile-source-files.js:69:35)
at Generator.next (<anonymous>)
at C:\Users\Tyler\Documents\GitHub\@ngx-easy\node_modules\ng-packagr\lib\ngc\compile-source-files.js:7:71
at new Promise (<anonymous>)
at __awaiter (C:\Users\Tyler\Documents\GitHub\@ngx-easy\node_modules\ng-packagr\lib\ngc\compile-source-files.js:3:12)
at Object.compileSourceFiles (C:\Users\Tyler\Documents\GitHub\@ngx-easy\node_modules\ng-packagr\lib\ngc\compile-source-files.js:19:12)
at Object.<anonymous> (C:\Users\Tyler\Documents\GitHub\@ngx-easy\node_modules\ng-packagr\lib\ng-v5\entry-point\ts\compile-ngc.transform.js:37:60)
at Generator.next (<anonymous>)
at C:\Users\Tyler\Documents\GitHub\@ngx-easy\node_modules\ng-packagr\lib\ng-v5\entry-point\ts\compile-ngc.transform.js:7:71
at new Promise (<anonymous>)
Expected Behaviour
Successful compilation for publishing.
Version Information
"@angular/compiler-cli": "^6.0.0-rc.1",
"@angular-devkit/build-ng-packagr": "~0.5.10",
"@angular-devkit/build-angular": "~0.5.10",
"ng-packagr": "^2.4.2",
"tsickle": ">=0.27.5",
"tslib": "^1.9.0",
"typescript": "2.7.2",
"@angular/cli": "~6.0.0-rc.6",
Issue Analytics
- State:
- Created 5 years ago
- Comments:11 (3 by maintainers)
Top Results From Across the Web
Solving AOT Error in NgRx: Function calls are not supported in ...
ERROR in src/app/app.module.ts(33,25): Error during template compile of 'AppModule' Function calls are not supported in decorators but 'createAction' was ...
Read more >ERROR Function calls are not supported in decorators but ...
Error during template compile of 'AppRoutingModule' Function calls are not supported in decorators but 'NativeScriptRouterModule' was called. It ...
Read more >Building Angular 6 library fails, with a vague error.
Function calls are not supported in decorators but 'ɵmakeDecorator' was called. Error during template compile of 'Injectable'. Function calls are not supported ......
Read more >Function calls are not supported in decorators but '' was called
Is this an Angular 10 issue or a typescript issue? > Error during template compile of 'AppComponent' Function calls are > not supported...
Read more >Error in prod build :Function calls are not supported in ...
ERROR in Error during template compile of 'MainModule' Function calls are not supported in decorators but 'InputEditorModule' was called.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
preface: I hate tsconfig.
@wardbell ng-packagr auto-generates a tsconfig for build. TL;DR it’s just releasing 3.0.0-rc.3 that enables
fullTemplateTypeCheck
and should solve your specific build issueLong story:
The combinations I tried were:
Build success
Build failures
Looks like the
@dynamic
has no effect in this case. Though what I noticed was that settingfullTemplateTypeCheck
does stop the error. I’ll log an error with Angular.