gitlab-org--gitlab-foss/babel.config.js

44 lines
1.1 KiB
JavaScript
Raw Normal View History

const coreJSVersion = require('./node_modules/core-js/package.json').version;
let presets = [
2018-10-02 17:11:53 -04:00
[
'@babel/preset-env',
{
useBuiltIns: 'usage',
corejs: { version: coreJSVersion, proposals: true },
2018-10-02 17:11:53 -04:00
modules: false,
},
],
];
// include stage 3 proposals
const plugins = [
'@babel/plugin-proposal-class-properties',
'@babel/plugin-proposal-json-strings',
2019-01-09 01:20:56 -05:00
'@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',
2018-10-02 17:11:53 -04:00
];
// Jest is running in node environment
const isJest = Boolean(process.env.JEST_WORKER_ID);
2019-04-25 09:38:15 -04:00
if (isJest) {
presets = [
[
'@babel/preset-env',
{
targets: {
node: 'current',
},
},
],
];
2018-08-29 16:45:53 -04:00
}
module.exports = { presets, plugins, sourceType: 'unambiguous' };