-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathbabel.config.js
More file actions
29 lines (26 loc) · 877 Bytes
/
babel.config.js
File metadata and controls
29 lines (26 loc) · 877 Bytes
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
module.exports = (api) => {
// base config for rollup
const babelPresetEnv = ['@babel/preset-env', { modules: false }];
const config = {
presets: [babelPresetEnv],
plugins: [
// 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',
],
};
// storybook and visual regression tests
if (api.env('storybook')) {
babelPresetEnv[1] = { targets: { esmodules: true } };
config.presets.push('@babel/preset-react');
}
// jest tests
if (api.env('test')) {
// tests are run in a node environment, not a browser
babelPresetEnv[1] = { targets: { node: 'current' } };
config.plugins.push('require-context-hook');
}
return config;
};