I'm using Angular. For loading translation JSON files, I use dynamic imports. Eg.,
import { from, Observable } from 'rxjs';
import { TranslateLoader } from '@ngx-translate/core';
export class CustomTranslateLoader implements TranslateLoader {
getTranslation(path: string): Observable<any> {
return from(import(`src/assets/i18n/${path}.json`));
}
}
During build, separate chunks/files are generated for each file, but I see that the content of all the files are included in the main bundle too and the files are not retrieved on runtime.