Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Function calls are not supported in decorators but 'ConfigModule' was called. #163

Closed
8 tasks
vadal opened this issue May 13, 2020 · 6 comments
Closed
8 tasks

Comments

@vadal
Copy link

vadal commented May 13, 2020

I'm submitting a ... (check one with "x")

[x ] Regression (a behavior that used to work and stopped working in a new release)
[ ] Bug report  <!-- Please check the repository for a similar issue or PR before submitting -->
[ ] Support request => <!-- Please check the repository for a similar issue or PR before submitting -->
[ ] Feature request
[ ] Documentation issue or request

Current behavior

export function configLoaderFactory(http: HttpClient): ConfigLoader {
const endpoint =./assets/configuration/config.json;
return new ConfigHttpLoader(http, endpoint);
}

@NgModule({
imports: [
ConfigModule.forRoot({
provide: ConfigLoader,
useFactory: configLoaderFactory,
deps: [HttpClient]
})
],...
This code causes the following error, when I try to update angular version to 9.
Error: error TS100: Error during template compile of 'AppConfigModule'
Function calls are not supported in decorators but 'ConfigModule' was called.

Any idea?

Expected/desired behavior

I should not cause an error.
Minimal reproduction of the problem with instructions

What is the motivation / use case for changing the behavior?

Environment

  • Angular version: 9.1.6
  • ngx-config/core version: 9.0.0
  • Browser:
  • Chrome (desktop) version XX
  • Chrome (Android) version XX
  • Chrome (iOS) version XX
  • Firefox version XX
  • Safari (desktop) version XX
  • Safari (iOS) version XX
  • IE version XX
  • Edge version XX
  • For Tooling issues:
  • Node version: 12.16.1
  • Platform: Mac
  • Others:
@anvial
Copy link

anvial commented May 13, 2020

The same error in prod build

@AncelHernandez
Copy link

AncelHernandez commented May 28, 2020

This issue is resolved by updating the tsconfig.package.json file to disable compiling the lib with ivy.

  "angularCompilerOptions": {
    "enableIvy": false
  }

When you build a lib with ivy the cli gives you a warning.

It is not recommended to publish Ivy libraries to NPM repositories.
Read more here: https://v9.angular.io/guide/ivy#maintaining-library-compatibility

Would push up a PR but i don't have permission.

@AncelHernandez
Copy link

AncelHernandez commented May 28, 2020

PR Created, first PR on an open source repo so bare with me 😅

@elendil-software
Copy link

Any news about this issue/PR ?

I have the same problem.

Regards

@s-albert
Copy link

I have the same problem when I run "ng xi18n" (while ng build is fine): ERROR in Error during template compile of 'AppModule'
Function calls are not supported in decorators but 'ConfigModule' was called. When I comment out ConfigModule.forRoot ng xi18n returns without an error.

@fulls1z3
Copy link
Owner

fulls1z3 commented Jul 8, 2021

see #169

@fulls1z3 fulls1z3 closed this as completed Jul 8, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants