-
Notifications
You must be signed in to change notification settings - Fork 105
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Load the Intl.Segmenter and Intl.DurationFormat polyfills only if needed #2778
Conversation
6492ce0
to
ab3a322
Compare
import { useTranslation } from "react-i18next"; | ||
|
||
import { ReactionIndicator } from "./ReactionIndicator"; | ||
|
||
const durationFormatter = new DurationFormat(undefined, { | ||
const durationFormatter = new Intl.DurationFormat(undefined, { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This landed in Node 23, so we will need to polyfill the tests.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed! I also had to embed the translations in tests, as now the initializer waits for i18next to initialise now before continuing
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh but your polyfill code should actually be doing this, ugh??
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
initializeBeforeReact
isn't necessarily being run in tests
f54bfa8
to
80bac32
Compare
This removes around 200Kb of the main bundle.
It will still load the polyfill if needed (notably the previous Firefox ESR), but skips on modern browsers.