-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Description
Which package?
@formatjs/intl-pluralrules/polyfill
Describe the bug
While not a bug per se, merely importing @formatjs/intl-pluralrules/polyfill causes a one second stall on a low-end Android device in a React Native project. For context, this is ~1s out of ~3.5s of our startup time, i.e. this polyfill is almost a third of the entire app's initialization time (which uses many other libraries including RN core itself).
I'm not sure what's special about this polyfill in particular. Maybe it's hitting some bad case. From inspecting the code, one thing that jumps out to me is that it pulls in the entirety of @formatjs/ecma402-abstract because it targets CJS, so a bunch of code gets initialized just to get invariant, FormatNumericToString, and ToNumber. Maybe publishing an ESM version would avoid that.
To Reproduce
This is reproducible with the Bluesky app (fully open source) on Samsung Galaxy A12. If there is interest, I can give more detailed instructions, but it's essentially about installing it, running yarn, then yarn android to run it on an Android simulator (assuming you have one set up).