ng-packagr: Error during template compile of 'MyModule'
Type of Issue
Error when importing the compiled library
[x] Bug Report
[ ] Feature Request
Description
After running ng-packagr, I get the bundle and everything just fine, but when I’m going to import it in my Angular 5 App I get the error:
ERROR in Error during template compile of 'MyModule' Function calls are not supported in decorators in 'NgModule' 'NgModule' calls a function at @angular/core/core.ts(194,50).
I’m importing it like:
import { CountDownModule, CountDownComponent } from '../../../../projectLab/ng2-date-countdown'
@NgModule({
declarations: [
AppComponent,
CountDownComponent
],
imports: [
BrowserModule,
CountDownModule,
],
How To Reproduce
Build an library with ng-packagr and import it in an Angular app.
Expected Behaviour
No errors
Version Information
ng-packagr: 2.0.0
@angular/*: x.y.z
typescript: x.y.z
rxjs: x.y.z
node: x.y.z
npm/yarn: x.y.z
please include any version information that might be relevant, e.g. other third-party libraries
About this issue
- Original URL
- State: closed
- Created 6 years ago
- Reactions: 9
- Comments: 22 (4 by maintainers)
@Gary-Pan You’re shipping
dependenciesanddevDependencieswith the@my/libpackage. See https://github.com/Gary-Pan/my-lib/blob/master/package.json#L10-L44@matheushf You’re shipping
devDependencieswith your library. Thedist/package.jsonis:Hi everyone, I suspect my package is failing for the same reason.
The error stacktrace is simply:
Not sure why, but my package returns no issues if I link it locally. 🤔
If anyone wants to take a look at the code, here is the package: https://github.com/Gbuomprisco/ngx-content-loading.
Thanks!