diff --git a/ui/engine/capabilities/IntlPolyfills/index.ts b/ui/engine/capabilities/IntlPolyfills/index.ts index 97af66fa6f0..2b468ec891d 100644 --- a/ui/engine/capabilities/IntlPolyfills/index.ts +++ b/ui/engine/capabilities/IntlPolyfills/index.ts @@ -33,6 +33,10 @@ declare const ENV: { const FORMAT_JS_DIR = '/dist/@formatjs' +// TODO: FOO-4658 to research and generally clean this up the right way. +// Short-circuiting this factored-out funcion for now until we get to the bottom +// of the pathname mapping issue. +// eslint-disable-next-line @typescript-eslint/no-unused-vars function localeDataFor(sys: string, locale: string): string { return `${FORMAT_JS_DIR}/intl-${sys}/locale-data/${locale}.js` } @@ -143,9 +147,7 @@ const subsystems: {[subsys: string]: Capability} = { subsysName: 'PluralRules', should: spfPR, polyfill: () => import('@formatjs/intl-pluralrules/polyfill-force'), - // rspack doesn't know that localeDataFor returns a string, so it throws a warning. Interpolating - // the string fixes the warning. - localeLoader: (l: string) => import(`${localeDataFor('pluralrules', l)}`), + localeLoader: (l: string) => import('@formatjs/intl-pluralrules/locale-data/' + l), }), datetimeformat: polyfillerFactory({ @@ -155,21 +157,21 @@ const subsystems: {[subsys: string]: Capability} = { await import('@formatjs/intl-datetimeformat/polyfill-force') await import('@formatjs/intl-datetimeformat/add-all-tz') }, - localeLoader: (l: string) => import(`${localeDataFor('datetimeformat', l)}`), + localeLoader: (l: string) => import('@formatjs/intl-datetimeformat/locale-data/' + l), }), numberformat: polyfillerFactory({ subsysName: 'NumberFormat', should: spfNF, polyfill: () => import('@formatjs/intl-numberformat/polyfill-force'), - localeLoader: (l: string) => import(`${localeDataFor('numberformat', l)}`), + localeLoader: (l: string) => import('@formatjs/intl-numberformat/locale-data/' + l), }), relativetimeformat: polyfillerFactory({ subsysName: 'RelativeTimeFormat', should: spfRTF, polyfill: () => import('@formatjs/intl-relativetimeformat/polyfill-force'), - localeLoader: (l: string) => import(`${localeDataFor('relativetimeformat', l)}`), + localeLoader: (l: string) => import('@formatjs/intl-relativetimeformat/locale-data/' + l), }), }