Translation en.json file not found error when build electron with angular

I am developing an Angular + Electron project. In that I am using angular-translate functionality and I have an en.json file in the /src/assets/i18n folder. Everything works good on the browser.

But when I run electron build, it is failed to load the en.json file. It is showing the error

Failed to load resource: net::ERR_FILE_NOT_FOUND

and it is referring to the url


The en.json is actually located in dist/myProject/assets/i18n directory.

How can I fix this issue? I tried adding


in asssets in angular.json file. Then also there is no change in the result. How can I fix this? Any help could be appreciated.

I have fixed this issue. I added below code in app.module.ts

export function HttpLoaderFactory(http: HttpClient) {
  return new TranslateHttpLoader(http, './assets/i18n/', '.json');