Skip to content

Commit

Permalink
Drop polyfills
Browse files Browse the repository at this point in the history
Signed-off-by: Taylor Smock <tsmock@meta.com>
  • Loading branch information
tsmock committed May 31, 2023
1 parent e89aa68 commit c473fd5
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 22 deletions.
3 changes: 0 additions & 3 deletions frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,6 @@
"license": "BSD-2-Clause",
"private": false,
"dependencies": {
"@formatjs/intl-locale": "^3.1.1",
"@formatjs/intl-pluralrules": "^5.1.10",
"@formatjs/intl-relativetimeformat": "^11.1.10",
"@hotosm/id": "^2.21.1",
"@hotosm/iso-countries-languages": "^1.1.2",
"@mapbox/mapbox-gl-draw": "^1.3.0",
Expand Down
20 changes: 1 addition & 19 deletions frontend/src/utils/polyfill.js
Original file line number Diff line number Diff line change
@@ -1,21 +1,3 @@
import { shouldPolyfill } from '@formatjs/intl-locale/should-polyfill';
import { shouldPolyfill as shouldPolyfillPluralRules } from '@formatjs/intl-pluralrules/should-polyfill';
import { shouldPolyfill as shouldPolyfillRelativeTimeFormat } from '@formatjs/intl-relativetimeformat/should-polyfill';

export const polyfill = async (locale) => {
if (shouldPolyfill()) {
await import('@formatjs/intl-locale/polyfill');
}
if (shouldPolyfillPluralRules(locale)) {
const unsupportedLocalePluralRules = shouldPolyfillPluralRules(locale);
await import('@formatjs/intl-pluralrules/polyfill-force');
await import(`@formatjs/intl-pluralrules/locale-data/${unsupportedLocalePluralRules}`);
}
if (shouldPolyfillRelativeTimeFormat(locale)) {
const unsupportedLocaleRelativeTimeFormat = shouldPolyfillRelativeTimeFormat(locale);
await import('@formatjs/intl-relativetimeformat/polyfill-force');
await import(
`@formatjs/intl-relativetimeformat/locale-data/${unsupportedLocaleRelativeTimeFormat}`
);
}
// Do nothing until we need polyfills again
};

0 comments on commit c473fd5

Please sign in to comment.