I have recently updated my Angular application to V12. I am using Angular's own Internationalization library @angular/localize
. I am using webpack's raw-loader
to load the xlf translation files as a string in my main.ts using the following code
const locale = document['locale'] as string;
const translations = require(`raw-loader!./assets/locale/messages.${locale}.xlf`).default;
platformBrowserDynamic().bootstrapModule(AppModule, {
providers: [
{ provide: TRANSLATIONS, useValue: translations },
{ provide: LOCALE_ID, useValue: locale },
{ provide: TRANSLATIONS_FORMAT, useValue: 'xlf' }
]
});
After the update I get the following error Error: Module not found: Error: Can't resolve 'raw-loader'
What could be the reason for this? Is there any way other than raw-loader?