This repository has been archived by the owner on Nov 8, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 70
404 Error with webpack and interceptor #58
Comments
I encountered this issue in my project as well, anyway to solve it? |
@LSmint
...
|
@Nurgunkalol , Yes Thanks! It is works! |
import { HttpClient, HttpClientModule, HTTP_INTERCEPTORS, HttpBackend } from '@angular/common/http';
@Injectable({providedIn: 'root'})
export class HttpClientTrans extends HttpClient {
constructor(handler: HttpBackend) {
super(handler);
}
}
export function HttpLoaderFactory(httpClient: HttpClientTrans) {
return new TranslateHttpLoader(httpClient, "/i18n/", ".json");
} @NgModule({
declarations: [
AppComponent
],
imports: [
...
HttpClientModule,
TranslateModule.forRoot({
loader: {
provide: TranslateLoader,
useFactory: HttpLoaderFactory,
deps: [HttpClientTrans]
}
}),
...
],
providers: [
{
provide: HTTP_INTERCEPTORS,
useClass: HttpInterceptorService,
multi: true,
},
], |
For anyone having a similar issue, this might be your solution without needing to bundle everything together: |
@Nurgunkalol So we can use (as per dynamic import for ES module) instead of |
Had a similar issue, causing circular dependencies. |
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Im using nativescript-angular
when i build it with webpack it shows error
The text was updated successfully, but these errors were encountered: