question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

AOT Compiling Error - Function calls are not supported in decorators but 'MetaModule' was called

See original GitHub issue

I’m submitting a … (check one with “x”)

[x] Bug report 

Current behavior When trying to compile my Angular 9 app with AOT, I’m getting the following error:

ERROR in Error during template compile of 'SharedModule'
  Function calls are not supported in decorators but 'MetaModule' was called.
Unexpected value 'undefined' imported by the module 'SharedModule in /src/app/shared/shared.module.ts'
Can't export value MetaModule in /node_modules/@ngx-meta/core/meta.module.d.ts from SharedModule in /src/app/shared/shared.module.ts as it was neither declared nor imported!
Error during template compile of 'SharedModule'
  Function calls are not supported in decorators but 'MetaModule' was called.
export const metaFactory = (): MetaStaticLoader =>
  new MetaStaticLoader({
    pageTitlePositioning: PageTitlePositioning.PrependPageTitle,
    pageTitleSeparator: ' - ',
    applicationName: 'XYZ',
    defaults: {
      title: 'XYZ',
      description: 'xyz',
    }
  });

@NgModule({
  ...
  imports: [
    MetaModule.forRoot({
      provide: MetaLoader,
      useFactory: metaFactory
    })
  ]
  exports: [
    ...
    MetaModule
  ]
});

When I remove this package from the modules, it is able to compile properly.

Expected/desired behavior Able to compile with @ngx-meta/core with AOT

Environment

  • Angular version: 9.1.0

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:9
  • Comments:7 (1 by maintainers)

github_iconTop GitHub Comments

3reactions
DennyReMcommented, Oct 14, 2020

if you use Angular version less then 9 try to install version of package less then 8 ,for my app with v8.2 version 8.0.2 compiled!

2reactions
williamareynoldscommented, Jun 19, 2020

Same issue on Angular CLI 9.1.8

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to get rid of Function calls are not supported in ...
ERROR in Error during template compile of 'AppModule' Function calls are not supported in decorators but 'ChartModule' was called. Now, i know ...
Read more >
Solving AOT Error in NgRx: Function calls are not supported in ...
... Error during template compile of 'AppModule' Function calls are not supported in decorators but 'createAction' was called in 'reducers'.
Read more >
Function calls are not supported in decorators while ng build ...
ERROR in Error during template compile of 'AppModule' Function calls are not supported in decorators but 'BsDropdownModule' was called.
Read more >
AOT metadata errors - Angular
Function calls are not supported. Consider replacing the function or lambda with a reference to an exported function. The compiler does not currently...
Read more >
Function calls are not supported in decorators but '' was called
Similar code works fire with another Ionic 5 Angular 9 project I created. Is this an Angular 10 issue or a typescript issue?...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found