-
由 Lukas Eipert 创作于
This rather new setting (ehrm, 3 years old) is well explained in the release blog post: https://babeljs.io/blog/2020/03/16/7.9.0#babelpreset-envs-bugfixes-option-11083 In our code base it has the following effect: 1. Safari / Webkit has a bug https://bugs.webkit.org/show_bug.cgi?id=220517 related to destructuring function arguments. 2. `@babel/preset-env` will turn on `transform-parameters`. 3. With the bugfixes setting enabled, it will turn on `bugfix-safari-id-destructuring-collision-in-function-expression` instead which only transpiles the specific bug case which we might not even have in our code base
由 Lukas Eipert 创作于This rather new setting (ehrm, 3 years old) is well explained in the release blog post: https://babeljs.io/blog/2020/03/16/7.9.0#babelpreset-envs-bugfixes-option-11083 In our code base it has the following effect: 1. Safari / Webkit has a bug https://bugs.webkit.org/show_bug.cgi?id=220517 related to destructuring function arguments. 2. `@babel/preset-env` will turn on `transform-parameters`. 3. With the bugfixes setting enabled, it will turn on `bugfix-safari-id-destructuring-collision-in-function-expression` instead which only transpiles the specific bug case which we might not even have in our code base
代码所有者
将用户和群组指定为特定文件更改的核准人。 了解更多。
babel.config.js 1.09 KiB
const coreJSVersion = require('./node_modules/core-js/package.json').version;
let presets = [
[
'@babel/preset-env',
{
useBuiltIns: 'usage',
bugfixes: true,
corejs: { version: coreJSVersion, proposals: true },
modules: false,
},
],
];
// include stage 3 proposals
const plugins = [
'@babel/plugin-proposal-class-properties',
'@babel/plugin-proposal-json-strings',
'@babel/plugin-proposal-private-methods',
// See: https://gitlab.com/gitlab-org/gitlab/-/issues/229146
'@babel/plugin-transform-arrow-functions',
// See: https://gitlab.com/gitlab-org/gitlab/-/issues/336216
'@babel/plugin-proposal-optional-chaining',
// See: https://gitlab.com/gitlab-org/gitlab/-/issues/336216
'@babel/plugin-proposal-nullish-coalescing-operator',
'lodash',
];
// Jest is running in node environment
const isJest = Boolean(process.env.JEST_WORKER_ID);
if (isJest) {
presets = [
[
'@babel/preset-env',
{
targets: {
node: 'current',
},
},
],
];
}
module.exports = { presets, plugins, sourceType: 'unambiguous' };