Ngx-bootstrap: AOT build error: Calling function 'TabsModule', function calls are not supported

Created on 12 Aug 2017  路  17Comments  路  Source: valor-software/ngx-bootstrap

Starting from a working simple project with AOT building correctly: BrainCrumbz/ngtools-webpack-demo/. Just adding Bootstrap CSS stylesheet and registering TabsModule.forRoot() causes the following:

ERROR in Error encountered resolving symbol values statically. Calling function 'TabsModule', function calls are not supported. Consider replacing the function or lambda with a reference to an exported function, resolving symbol AppModule in D:/WS/JS/ngtools/ngtools-webpack-demo/src/app/module.ts, resolving symbol AppModule in D:/WS/JS/ngtools/ngtools-webpack-demo/src/app/module.ts

See this commit to see changes made and to repro issue.

Environment:

  • ngx-bootstrap 1.8.1
  • angular 4.3.4
  • ngtools/webpack 1.3.3
  • webpack 2.5.1
  • Win 10 x64
comp(build) reproduce

All 17 comments

If it can help, same thing happens when dropping TabsModule and trying with e.g.:

import { BsDropdownModule } from 'ngx-bootstrap/dropdown';
// ...
    BsDropdownModule.forRoot(),

or:

import { CollapseModule } from 'ngx-bootstrap/collapse';
// ...
    CollapseModule.forRoot(),

this is most annoying kind of issues, cuz it works fine with angular-cli

Hi there. Any hint on this? Is there any way I can help?

Thank you

+1 same kind of error with BsDropdownModule

Could someone provide a repo with reproduction?

Has this been solved?

As far as I can't reproduce it anymore, counted as solved

[Sorry for late reply]. I see, that was not clear to me. When you say anymore, is that because you tried with repro linked in the opening comment, and now it works ok for you? Or you tried with a more recent version? Or you have another "working demo"?

@GiuseppePiscopo have you tried to use latest version which is 2.0.0-beta.8 now?

Thanks for suggestion. Still the same error message. Repro:

  1. clone https://github.com/BrainCrumbz/ngtools-webpack-demo and checkout chore/ngx-boostrap branch
  2. npm install
  3. npm run build-prod

ok, now it's more clear to me, it's not ngx-bs issue
you have an issues with custom webpack config
please create stack overflow question with tags: angular webpack ngx-bootstrap

raw look at your setup didn't show me why it's broken

I see. Thanks for your feedback.

Sorry

Strange as it sounds, in my case, this error is not related to ngx-bootstrap at all. The error is caused by using typescript 2.4 string enum.

Yeah, it happens, my favourite useless issue is: app module has an error resolving modules metadata
And it fails with the link to first module, which usually is not a reason of an issue

Yes, link to the first module that does not belong to @angular/core. In my case, removing TabsModule, the error logs will be Calling function 'BsDropdownModule', function calls are not supported and so on.

  imports: [
    CommonModule,
    TabsModule.forRoot(),
    BsDropdownModule.forRoot(),
    PopoverModule.forRoot(),
    ModalModule.forRoot(),
    ....
Was this page helpful?
0 / 5 - 0 ratings

Related issues

juanitavollmering picture juanitavollmering  路  3Comments

tuoitrexuquang picture tuoitrexuquang  路  3Comments

Scooviese picture Scooviese  路  3Comments

tpiros picture tpiros  路  3Comments

ctrl-brk picture ctrl-brk  路  3Comments