ng-sticky
ng-sticky copied to clipboard
Error when building for production "ng build --prod"
ERROR in Error: Type NgStickyDirective in .../node_modules/ng-sticky/ng-sticky.d.ts is part of the declarations of 2 modules:
AppModule in .../src/app/app.module.ts
and
NgStickyModule in .../node_modules/ng-sticky/ng-sticky.d.ts!
Please consider moving NgStickyDirective in
.../node_modules/ng-sticky/ng-sticky.d.ts
to a higher module that imports AppModule in
.../src/app/app.module.ts and NgStickyModule
in
.../node_modules/ng-sticky/ng-sticky.d.ts.
You can also create a new NgModule that exports and includes NgStickyDirective in
.../node_modules/ng-sticky/ng-sticky.d.ts
then import that NgModule in AppModule in
.../src/app/app.module.ts and NgStickyModule
in
.../node_modules/ng-sticky/ng-sticky.d.ts
.
A simple work around... just import the whole NgStickyModule into your apps appropriate module.
Yes, moving NgStickyModule
to imports[]
works.
@NgModule({
declarations: [
AppComponent
],
imports: [
BrowserModule,
.....
.....
NgStickyModule,
],
.....
})
Will this workaround impact performance or size?
@mbn18 did your solution resolved the issue, I've moved it to imports[] but it is still throwing the same error while ng build --prod
@muneeb249 , Yep. As seen above
Then in the template
<header ng-sticky [offSet]="0" [addClass]="'is-sticky'">
And scss
.narrow header, header.is-sticky {