Conditional import polyfill

This commit is contained in:
Lim Chee Aun 2024-03-04 19:45:57 +08:00
parent 531147cbc3
commit 427207ae5a

View file

@ -4,12 +4,16 @@ import './cloak-mode.css';
// Polyfill needed for Firefox < 122 // Polyfill needed for Firefox < 122
// https://bugzilla.mozilla.org/show_bug.cgi?id=1423593 // https://bugzilla.mozilla.org/show_bug.cgi?id=1423593
import '@formatjs/intl-segmenter/polyfill'; import { shouldPolyfill } from '@formatjs/intl-segmenter/should-polyfill';
import { render } from 'preact'; import { render } from 'preact';
import { HashRouter } from 'react-router-dom'; import { HashRouter } from 'react-router-dom';
import { App } from './app'; import { App } from './app';
if (shouldPolyfill()) {
import('@formatjs/intl-segmenter/polyfill-force');
}
if (import.meta.env.DEV) { if (import.meta.env.DEV) {
import('preact/debug'); import('preact/debug');
} }