nthompson777 / ngx-foundation

The best way to quickly integrate Zurb Foundation for Sites 6 components with Angular 6 or 7.
http://ngxfoundation.com
MIT License
12 stars 3 forks source link

Missing NgModule annotation #2

Closed jvalkeejarvi closed 5 years ago

jvalkeejarvi commented 5 years ago

Something has gone wrong after deleting .map files from repo. With version 1.0.7 I'm getting following error: ERROR in : Unexpected value 'AccordionModule in C:/repos/xxxxxxxx/front/node_modules/ngx-foundation/accordion/accordion.module.d.ts' imported by the module 'ContactManagerModule in C:/repos/xxxxxxxx/front/src/app/modules/contact-manager/contact-manager.module.ts'. Please add a @NgModule annotation.

Same happens with ModalModule. Haven't tested other modules but I suspect that this happens with all of them.

jvalkeejarvi commented 5 years ago

Not directly related to this issue but I was just wondering why .ts files are not included in the repo? If you included those it would be easier to contribute.

nthompson777 commented 5 years ago

@jvalkeejarvi I'm not able to replicate this error, but I will work on publishing an update to fix. I may temporarily roll back to previous code in case it is breaking for others as well. Thank you for your interest in the framework. I appreciate it.

As far as including the .ts files...I am currently working on cleaning up the code and will publish a minor update (no breaking changes) within the next week or two with the .ts files included. This framework was my first NPM contribution, so I quickly realized I didn't do everything as optimally as I should have. If you're interested, I will message you once I post that minor update and if you'd like to contribute I would be more than happy to have your help.

nthompson777 commented 5 years ago

@jvalkeejarvi I'm still not able to replicate this issue. Before I make any changes, are you able to share a sample of your code (i.e. - stackblitz etc.) in any way?

jvalkeejarvi commented 5 years ago

Thanks for quick responses, really appreciate your work.

About the issue itself: This has something to do with Angular AoT (Ahead of Time) compile. Build is successful with command ng build but fails with ng build --aot. I wasn't able to enable aot in stackblitz but issue can be reproduced with following steps:

Modified app.module.ts:

import { BrowserModule } from '@angular/platform-browser';
import { NgModule } from '@angular/core';
import { AccordionModule } from 'ngx-foundation';

import { AppRoutingModule } from './app-routing.module';
import { AppComponent } from './app.component';

@NgModule({
  declarations: [
    AppComponent
  ],
  imports: [
    AccordionModule.forRoot(),
    BrowserModule,
    AppRoutingModule
  ],
  providers: [],
  bootstrap: [AppComponent]
})
export class AppModule { }
nthompson777 commented 5 years ago

@jvalkeejarvi AOT is the key. You're right with your findings and I'm able to replicate with similar errors. I will be rolling back today with a patch to code from 1.0.6. To keep your development moving along, I would suggest temporarily installing ngx-foundation v1.0.6 npm i ngx-foundation@1.0.6 OR yarn add ngx-foundation@1.0.6. Thank you @jvalkeejarvi! I appreciate it.

nthompson777 commented 5 years ago

@jvalkeejarvi This issue with AOT builds has been fixed with the 1.0.8 release. I reopened your previous issue and will keep that open until it is resolved.