From fbba77cd9f936427f11a7956b7f32b026d19eb4a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Felipe=20Buena=C3=B1o?= Date: Tue, 22 Feb 2022 11:07:45 -0500 Subject: [PATCH] build!: rm `targets`, add .browserslistrc (#1003) 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 --- .../src/__tests__/__snapshots__/index.test.js.snap | 7 ------- packages/babel-preset-kyt-core/src/index.js | 3 --- .../kyt-starter-static/starter-src/.browserslistrc | 12 ++++++++++++ .../starter-src/.browserslistrc | 12 ++++++++++++ 4 files changed, 24 insertions(+), 10 deletions(-) create mode 100644 packages/kyt-starter-static/starter-src/.browserslistrc create mode 100644 packages/kyt-starter-universal/starter-src/.browserslistrc diff --git a/packages/babel-preset-kyt-core/src/__tests__/__snapshots__/index.test.js.snap b/packages/babel-preset-kyt-core/src/__tests__/__snapshots__/index.test.js.snap index 6e57068a3..249bc1c36 100644 --- a/packages/babel-preset-kyt-core/src/__tests__/__snapshots__/index.test.js.snap +++ b/packages/babel-preset-kyt-core/src/__tests__/__snapshots__/index.test.js.snap @@ -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", }, ], diff --git a/packages/babel-preset-kyt-core/src/index.js b/packages/babel-preset-kyt-core/src/index.js index 21f0ee4bd..3da2c2877 100644 --- a/packages/babel-preset-kyt-core/src/index.js +++ b/packages/babel-preset-kyt-core/src/index.js @@ -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 = { diff --git a/packages/kyt-starter-static/starter-src/.browserslistrc b/packages/kyt-starter-static/starter-src/.browserslistrc new file mode 100644 index 000000000..46b0c453b --- /dev/null +++ b/packages/kyt-starter-static/starter-src/.browserslistrc @@ -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 diff --git a/packages/kyt-starter-universal/starter-src/.browserslistrc b/packages/kyt-starter-universal/starter-src/.browserslistrc new file mode 100644 index 000000000..46b0c453b --- /dev/null +++ b/packages/kyt-starter-universal/starter-src/.browserslistrc @@ -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