debian-mirror-gitlab/babel.config.js

44 lines
1.1 KiB
JavaScript
Raw Normal View History

2022-07-23 23:45:48 +05:30
const coreJSVersion = require('./node_modules/core-js/package.json').version;
2019-05-05 18:10:48 +05:30
2020-06-23 00:09:42 +05:30
let presets = [
2019-05-05 18:10:48 +05:30
[
'@babel/preset-env',
{
2020-03-13 15:44:24 +05:30
useBuiltIns: 'usage',
2022-07-23 23:45:48 +05:30
corejs: { version: coreJSVersion, proposals: true },
2019-05-05 18:10:48 +05:30
modules: false,
},
],
];
// include stage 3 proposals
const plugins = [
'@babel/plugin-proposal-class-properties',
'@babel/plugin-proposal-json-strings',
'@babel/plugin-proposal-private-methods',
2020-10-24 23:57:45 +05:30
// See: https://gitlab.com/gitlab-org/gitlab/-/issues/229146
'@babel/plugin-transform-arrow-functions',
2021-09-30 23:02:18 +05:30
// 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',
2020-03-13 15:44:24 +05:30
'lodash',
2019-05-05 18:10:48 +05:30
];
2022-07-23 23:45:48 +05:30
// Jest is running in node environment
2019-09-04 21:01:54 +05:30
const isJest = Boolean(process.env.JEST_WORKER_ID);
2019-07-31 22:56:46 +05:30
if (isJest) {
2020-06-23 00:09:42 +05:30
presets = [
[
'@babel/preset-env',
{
targets: {
node: 'current',
},
},
],
];
2019-05-05 18:10:48 +05:30
}
2020-03-13 15:44:24 +05:30
module.exports = { presets, plugins, sourceType: 'unambiguous' };