It makes npm run build (and watch) generate two builds: one for modern browsers and one for legacy browsers.
It defines which browsers each build should support in package.json (see the definition of defaults).
It loads either the modern build or the legacy build, depending on whether the browser supports ES6 modules.
It includes any necessary polyfills in each bundle using core-js.
I've included IE11 support by default because a lot of government organisations still have IE11 installed as the default browser, unfortunately, and government makes up a sizable portion of this product's user base. Fortunately, thanks to differential builds, modern browsers won't need to consume the IE11 build, so there's no real cost to doing so.
I've tested this in IE11 on browserstack and it seems to be working fine (whereas v2 didn't, otherwise).
Note that the modern build increased in size a bit (like 20 kb) when I added core-js, and I'm not sure why. I presume it's because some of the browser in defaults require polyfills, but I can't imagine what those would be 🤔
EDIT: Oh, and the process module was added by core-js (don't you just love when a dependency adds another top level dependency to your package.json on its own?...) - looks like it's a polyfill for node's process module, is all.
This pull request does a few things:
npm run build
(andwatch)
generate two builds: one for modern browsers and one for legacy browsers.package.json
(see the definition of defaults).I've included IE11 support by default because a lot of government organisations still have IE11 installed as the default browser, unfortunately, and government makes up a sizable portion of this product's user base. Fortunately, thanks to differential builds, modern browsers won't need to consume the IE11 build, so there's no real cost to doing so.
I've tested this in IE11 on browserstack and it seems to be working fine (whereas v2 didn't, otherwise).
Note that the modern build increased in size a bit (like 20 kb) when I added core-js, and I'm not sure why. I presume it's because some of the browser in
defaults
require polyfills, but I can't imagine what those would be 🤔EDIT: Oh, and the
process
module was added bycore-js
(don't you just love when a dependency adds another top level dependency to yourpackage.json
on its own?...) - looks like it's a polyfill for node'sprocess
module, is all.Closes #246