Conversation
**Why**: - So that we can have a common and consistent source of truth for supported browsers, as interpreted by tools which make use of it (namely, Babel and Autoprefixer). - To marginally reduce the size of CSS stylesheets by eliminating unnecessary browser prefixes (-0.1kb brotli'd) changelog: Improvements, Optimization, Reduce size of CSS stylesheets
babel.config.js
Outdated
| return { | ||
| presets: [ | ||
| ['@babel/preset-env', { targets: isTestEnv ? 'current node' : '> 1% or IE 11' }], | ||
| ['@babel/preset-env', { targets: isTestEnv ? 'current node' : undefined }], |
There was a problem hiding this comment.
would it make sense to define a targets so we can declare this once?
const targets = isTestEnv ? 'current node' : undefined;
...
['@babel/preset-env', { targets }],There was a problem hiding this comment.
Yeah, I was wondering if there might be a way to simplify / share some of this configuration.
The challenge comes from the other targets configuration below, targeting our modern polyfills:
Line 20 in 4eba3d1
So while isTestEnv ? 'current node' : undefined is sorta the "default" targets configuration, it's not the only one.
I also don't love how the "modern polyfills" configuration reimplements part of the .browserslistrc configuration. It would be nicer as something like...
`(${config}) and supports es6-module`...but we don't want to include IE11 polyfills. It's hopefully a short-lived solution anyways, with us eventually (🤞 ) dropping support for IE11.
There was a problem hiding this comment.
I think it's probably best to treat the "default" targets as the desirable (post-Internet Explorer) targets configuration, so consolidated in 86fe2bd.
Why:
Click to see stylesheet diff