core
core copied to clipboard
Angular 12 + Ivy
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
PS. I can not downgrade or upgrade angular app.
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.
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" [...]
any solution for this