With the introduction of TypeScript 2.4, dynamic import() expressions were added to allow for the asynchronous loading and execution of ECMAScript modules on demand.
I am currently facing an issue while trying to dynamically import the localization module.
Module not found: Error: Package path ./locales is not exported from package ....\node_modules\@angular\common (see exports field in .....\node_modules\@angular\common\package.json)
The code snippet I have is as follows:
let angularLocale = convertAbpLocaleToAngularLocale(abp.localization.currentLanguage.name);
import(`@angular/common/locales/${angularLocale}.js`)
.then(module => {
registerLocaleData(module.default);
NgxBootstrapDatePickerConfigService.registerNgxBootstrapDatePickerLocales().then(_ => {
resolve(true);
abp.ui.clearBusy();
});
}, reject);
I am unsure about how to export this correctly, as it was functioning properly with Angular 12.