wannabegeek / ng2-split-pane

Split View module for Angular 2
MIT License
43 stars 25 forks source link

ERROR in SplitPaneModule is not an NgModule #15

Closed vstoykov closed 7 years ago

vstoykov commented 7 years ago

This happens when I run ng serve or ng build.

The funny part is that when I run ng serve I just need to save something in the project in order to rebuild live server and everything starts working. The problem is that I can't build it.

When I run ng build -prod the error is little different but related:

ERROR in Unexpected value 'SplitPaneModule in /path/to/app/node_modules/ng2-split-pane/lib/ng2-split-pane.d.ts' imported by the module 'AppModule in /path/to/app/src/app/app.module.ts'

ERROR in ./src/main.ts
Module not found: Error: Can't resolve './$$_gendir/app/app.module.ngfactory' in '/path/to/app/src'
 @ ./src/main.ts 5:0-74
 @ multi ./src/main.ts

I found this issue in angular-cli https://github.com/angular/angular-cli/issues/4447 and problem is caused by requirement of AOT compilation of 3th party modules.

This issue is probably duplicate of #4 #13 and #14 but I just wanted to write it in order to link all related stuff and probably to be easy for others when search with error message provided by angular cli to land here instead of wasting time looking everywhere on internet.

vstoykov commented 7 years ago

Even after #18 (ng2-split-module 1.2.1) I still get this error.

wannabegeek commented 7 years ago

Ok, I haven't been able to re-produce this error.

However, please could you try installing the latest beta version and see if that resolves it? npm install ng2-split-pane@beta

This version is build using ngc, and contains metadata files for AoT, so I'm hoping this resolves it.

Many thanks.

simongregersen commented 7 years ago

@vstoykov In my humble opinion, this looks more like an issue with your application. Can you submit something that reproduces the issue?

philhof commented 7 years ago

Good news up-front, the issue seems to be solved using the latest version 1.3.0!

Steps to reproduce the issue with ng2-split-pane version 1.2.1:

Retest with 1.3.0:

ginocarrascomori commented 7 years ago

Same here, 1.2.1 did't work but 1.3.0 did

simongregersen commented 7 years ago

Ahaaa, indeed it looks the library packaging process was the issue then - I've been working on the typescript files directly (src-folder) and not from the lib folder.

wannabegeek commented 7 years ago

I have just released 1.3.1 (same codebase but "latest" tag instead of "beta") which fixes this. Thanks for your contributions & help resolving this.

Herdubreid commented 7 years ago

I tried the latest version, 1.3.1 and it gave me "ERROR in SplitPaneModule is not an NgModule". I then installed ng2-split-pane@1.3.0 which compiled fine.

guify commented 6 years ago

I get "ERROR in SplitPaneModule is not an NgModule" after "npm install ng2-split-pane@'1.4.0'".

Ha! Actually it works every now and then. It seems that I can jiggle things and get it working like this:

  1. run "ng serve"
  2. in another terminal, touch "app.module.ts"

Step 2 causes webpack to rerun, successfully.

Theory: Angular misses some state change caused by the "npm install", but picks it up the second time.