ngx-translate / http-loader

A loader for ngx-translate that loads translations with http calls
MIT License
191 stars 69 forks source link

Angular 9 compiler error #74

Closed Ram-vo closed 4 years ago

Ram-vo commented 4 years ago

Current behavior

ERROR in node_modules/@ngx-translate/http-loader/lib/http-loader.d.ts:4:22 - error NG6002: Appears in the NgModule.imports of AppModule, but could not be resolved to an NgModule class.

This likely means that the library (@ngx-translate/http-loader) which declares TranslateHttpLoader has not been processed correctly by ngcc, or 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.

4 export declare class TranslateHttpLoader implements TranslateLoader {
                       ~~~~~~~~~~~~~~~~~~~

How do you think that we should fix this?

I think that is an IVY compiler compatibility problem

Environment


ngx-translate version: X.Y.Z
Angular version: X.Y.Z


For Tooling issues:

Angular CLI: 9.0.7
Node: 13.5.0
OS: darwin x64

Angular: 9.0.7
Ivy Workspace: Yes

Package                           Version
-----------------------------------------------------------
@angular-devkit/architect         0.900.7
@angular-devkit/build-angular     0.900.7
@angular-devkit/build-optimizer   0.900.7
@angular-devkit/build-webpack     0.900.7
@angular-devkit/core              9.0.7
@angular-devkit/schematics        9.0.7
@angular/localize                 9.1.1
@ngtools/webpack                  9.0.7
@schematics/angular               9.0.7
@schematics/update                0.900.7
rxjs                              6.5.5
typescript                        3.7.5
webpack                           4.41.2
Ram-vo commented 4 years ago

I'm closing this issue cause apparently was my mistake. I leave here what I did to solve the error

app.module.ts

TranslateModule.forRoot({ loader: { provide: TranslateLoader, useFactory: httpTranslateLoader, deps: [HttpClient], }, }),

changed for:

TranslateModule.forRoot({ loader: { provide: TranslateLoader, useFactory: (http: HttpClient) => { return new TranslateHttpLoader(http, './assets/i18n/', '.json'); }, deps: [HttpClient] } }),