Ngx-bootstrap: chore(docs): AOT compilation is supposedly working, but it isn't for me

Created on 4 Oct 2016  路  24Comments  路  Source: valor-software/ngx-bootstrap

Hey guys,

first of all, this is a great package. Thanks for it!

With commit https://github.com/valor-software/ng2-bootstrap/commit/afabb9d the ominous message
Error: Unexpected value 'CollapseModule' imported by the module 'AppModule' should go away when compiling your app with ngc, but it isn't working for me. Still getting that error message, even though I have the latest ng2-bootstrap (version 1.1.6) installed and I see a ng2-bootstrap.metadata.json in node_modules/ng2-bootstrap.

Is there something else I have to change apart from upgrading ng2-bootstrap to 1.1.6?

Thanks.

Most helpful comment

known issue, working on it

All 24 comments

angular cli version?

@angular/compiler-cli has the version number 0.6.3.

too old

Which version am I supposed to use then? Notice: @angular/compiler-cli is not angular-cli.

ok, how can I reproduce it?

ok, thing is I am generating a sample app with ng cli
and than compiling it with ngc with out any issues

I need your sample to reproduce an issue

Where did @cummingsi1993's comment go?

I'll just quote him

I just reproduced it by using the latest version of angular2 libraries (2.0.1) and ng2-bootstrap 1.1.6 and then compiling using ngc.
Error was 'Unexpected value 'Angular2UIModule' imported by the module 'SharedModule''

I'm gonna set up a sample app ASAP. Fixing something else right now :P

@dhardtke don't know, may be he fixed it?

@dhardtke before doing anything please do:

  • clean npm install
  • and clean app rebuild

It usually helps

Will do.

I can import individual modules (like the alert module), but if i try to import the Ng2BootstrapModule i get
"Module not found: Error: Can't resolve '../node_modules/ng2-bootstrap/components/modal/modal-backdrop.component.ngfactory'"

Sorry, i realized that my error was with 'Angular2UI' not Ng2-Bootstrap. And i fixed that problem

Okay, did as you said and apparently a clean npm install fixed it :)

Thanks! 馃憤

Awesome :)

@cummingsi1993 wondering how did you resolve the beforementioned problem with modal-backdrop.component.ngfactory?

https://unpkg.com/[email protected]/components/modal/

It is in place, please try clean install and build

that problem only occurs when you import the Ng2BootstrapModule. You can work around it by importing the individual modules you need. (for example i imported the ButtonsModule)

I actually had to import TypeaheadModule and also import TypeaheadContainerComponent in order for AOT to work. Thank you everyone!

Hope someone can help, at first I just wanted to test out cli AOT, so I created a new git branch, installed the cli compiler and tried to run it. I then got similar errors mentioned: app/node_modules/ng2-bootstrap/components/index.ngfactory.ts(31,27): error TS2307: Cannot find module './modal/modal-backdrop.component.ngfactory'.
app/node_modules/ng2-bootstrap/components/index.ngfactory.ts(32,27): error TS2307: Cannot find module './tooltip/tooltip-container.component.ngfactory'.
...
I then checkout my previous branch, rm -rf node_modules, npm install, and tried building with normal tsc, and now I still get these errors. I have updated ng2-bootstrap to 1.1.6 but still no change.

Any advise or help is appreciated.

known issue, working on it

fix is actually simple,
just add missing internal components exports
testing...

ok fixed in latest version, please test

Was this page helpful?
0 / 5 - 0 ratings

Related issues

tuoitrexuquang picture tuoitrexuquang  路  3Comments

webdev48 picture webdev48  路  3Comments

RolfVeinoeSorensen picture RolfVeinoeSorensen  路  3Comments

Scooviese picture Scooviese  路  3Comments

juanitavollmering picture juanitavollmering  路  3Comments