As performance is always important I was wondering how to best include polyfills. I'd prefer to use codesplitting and then lazyload each polyfill if the current environment doesn't that support it.
Doing this manually requires more work which I would happily put in. eslint-plugin-compat would be a good helper in this case I guess.
Automating this process with sth. like babel-preset-env reduces the effort but does it bring the same performance benefits as doing it "manually"?
From my understanding, babel-preset-env is transpiling all that stuff out of the box but when you use useBuiltIns
it adding the corresponding polyfills, right? -> https://babeljs.io/docs/plugins/preset-env/#usebuiltins
But then again, does it always load all polyfills (files/modules) and checks within those if the polyfill is needed or does it load the polyfill modules conditionally if the fn isn't available on the window or prototype?
If you could point me in a direction or explain the way babel-preset-env works that would be great.
Help is much appreciated :)