core icon indicating copy to clipboard operation
core copied to clipboard

Angular 12 + Ivy

Open Bosper opened this issue 1 year ago • 4 comments

While library module being imported to any angular 12 application module - "TranslateModule' does not appear to be an NgModule class." error appears.

Current behavior

TranslateModule' does not appear to be an NgModule class.
This likely means that the library (@ngx-translate/core) which declares TranslateModule is not compatible with Angular Ivy. Check if a newer version of the library is available, and update if so. Also consider checking with the library's authors to see if the library is expected to be compatible with Ivy.

Expected behavior

No Ivy Error while library module is imported to angular application module.

How do you think that we should fix this?

Enable Ivy for ngx-translate/[email protected]

Minimal reproduction of the problem with instructions

imports: [ BrowserModule, TranslateModule.forRoot(),

Environment


ngx-translate version: 13.0.0
Angular 12.2.17

Browser:
- [*] Chrome (desktop)
 
For Tooling issues:
- Node version: 16.13.2
- Platform:  Windows

Bosper avatar May 25 '23 21:05 Bosper

PS. I can not downgrade or upgrade angular app.

Bosper avatar May 25 '23 21:05 Bosper

This does not happen in a fresh Angular 12 project. What I did:

  • Create a new project using npx @angular/cli@12 new
  • Install ngx-translate using npm i --save @ngx-translate/core@13
  • Import TranslateModule.forRoot(),

With this setup, the error does not appear. Please add a minimal reproduction.

json-derulo avatar May 26 '23 12:05 json-derulo

By default in package.json file there is no added a postinstall command: "postinstall": "ngcc".

Resolved by adding a line in package.json file: "scripts": { "postinstall": "ngcc" [...]

Bosper avatar May 26 '23 21:05 Bosper

any solution for this

moudgalya1223 avatar Mar 05 '24 13:03 moudgalya1223