forked from gitlabhq/gitlabhq
-
Notifications
You must be signed in to change notification settings - Fork 0
/
babel.config.js
44 lines (40 loc) · 1.09 KB
/
babel.config.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
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' };