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

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

Closed
asithade opened this issue May 20, 2020 · 7 comments

Comments

@asithade
Copy link

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
@constantinoschristoforou

I have the same issue

@williamareynolds
Copy link

Same issue on Angular CLI 9.1.8

@Ismaestro
Copy link

Same here with Angular CLI 9.1.10

@nishadmenezes
Copy link

I have the same issue too

@DennyReM
Copy link

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!

@asithade
Copy link
Author

asithade commented Nov 21, 2020

I'm seeing the same error again with Angular 11.

enableIvy: false
aot: true

Error during build:

  Function calls are not supported in decorators but 'MetaModule' was called.
Unexpected value 'undefined' imported by the module 'AppModule in /site/src/app/app.module.ts'
Error during template compile of 'AppModule'
  Function calls are not supported in decorators but 'MetaModule' was called.

Enabling ivy allows it to compile though

@fulls1z3
Copy link
Owner

fulls1z3 commented Jul 8, 2021

see #216

@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

7 participants