Skip to content

Commit

Permalink
build!: rm targets, add .browserslistrc (#1003)
Browse files Browse the repository at this point in the history
BREAKING CHANGE: `targets` are no longer set for `@babel/preset-env`.

In this commit, we introduced a breaking change in the way that browser
`targets` work, namely in that the targets are no longer set and the
user is expected to provide their own `.browserslistrc` or similar
configuration.

The previous behavior was to have browser `targets`, which overrides any
other configuration, including `.browserslistrc`.

From the `@babel/preset-env` documentation[^1]:
> By default `@babel/preset-env` will use browserslist config sources
> unless either the `targets` or `ignoreBrowserslistConfig` options are
> set.

When upgrading to the next major version that includes this change, *you
must provide your own configuration* or else Babel will default to using
the oldest browsers available[^2].

1. https://babeljs.io/docs/en/babel-preset-env#browserslist-integration
2. https://babeljs.io/docs/en/options#no-targets
  • Loading branch information
fesebuv authored and woodb committed Feb 25, 2022
1 parent ba3290c commit fbba77c
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -37,13 +37,6 @@ Object {
"corejs": "3.18.0",
"forceAllTransforms": true,
"modules": "commonjs",
"targets": Object {
"browsers": Array [
">1%",
"last 4 versions",
"not ie < 11",
],
},
"useBuiltIns": "entry",
},
],
Expand Down
3 changes: 0 additions & 3 deletions packages/babel-preset-kyt-core/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,6 @@ module.exports = function getPresetCore(context, opts) {
useBuiltIns: 'entry',
corejs: pkg.dependencies['core-js'],
forceAllTransforms: true,
targets: {
browsers: ['>1%', 'last 4 versions', 'not ie < 11'],
},
};

const serverEnvOptions = {
Expand Down
12 changes: 12 additions & 0 deletions packages/kyt-starter-static/starter-src/.browserslistrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# Browsers that we support

>1%
last 4 versions
not ie > 0
not bb > 0
not ie_mob > 0
not opera > 0
not kaios > 0
not op_mob > 0
not op_mini all
not baidu > 0
12 changes: 12 additions & 0 deletions packages/kyt-starter-universal/starter-src/.browserslistrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# Browsers that we support

>1%
last 4 versions
not ie > 0
not bb > 0
not ie_mob > 0
not opera > 0
not kaios > 0
not op_mob > 0
not op_mini all
not baidu > 0

0 comments on commit fbba77c

Please sign in to comment.