2020-03-05 17:20:45 -05:00
|
|
|
/**
|
|
|
|
* Licensed to the Apache Software Foundation (ASF) under one
|
|
|
|
* or more contributor license agreements. See the NOTICE file
|
|
|
|
* distributed with this work for additional information
|
|
|
|
* regarding copyright ownership. The ASF licenses this file
|
|
|
|
* to you under the Apache License, Version 2.0 (the
|
|
|
|
* "License"); you may not use this file except in compliance
|
|
|
|
* with the License. You may obtain a copy of the License at
|
|
|
|
*
|
|
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
*
|
|
|
|
* Unless required by applicable law or agreed to in writing,
|
|
|
|
* software distributed under the License is distributed on an
|
|
|
|
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
|
|
* KIND, either express or implied. See the License for the
|
|
|
|
* specific language governing permissions and limitations
|
|
|
|
* under the License.
|
|
|
|
*/
|
2021-11-17 02:31:36 -05:00
|
|
|
const packageConfig = require('./package');
|
2020-03-19 17:57:39 -04:00
|
|
|
|
2020-03-05 17:20:45 -05:00
|
|
|
module.exports = {
|
|
|
|
sourceMaps: true,
|
2020-03-19 17:57:39 -04:00
|
|
|
sourceType: 'module',
|
2020-03-05 17:20:45 -05:00
|
|
|
retainLines: true,
|
|
|
|
presets: [
|
|
|
|
[
|
|
|
|
'@babel/preset-env',
|
|
|
|
{
|
|
|
|
useBuiltIns: 'usage',
|
|
|
|
corejs: 3,
|
|
|
|
loose: true,
|
2020-03-18 12:01:02 -04:00
|
|
|
modules: false,
|
2020-03-19 17:57:39 -04:00
|
|
|
shippedProposals: true,
|
|
|
|
targets: packageConfig.browserslist,
|
2020-03-05 17:20:45 -05:00
|
|
|
},
|
|
|
|
],
|
2020-03-19 17:57:39 -04:00
|
|
|
[
|
|
|
|
'@babel/preset-react',
|
|
|
|
{ development: process.env.BABEL_ENV === 'development' },
|
|
|
|
],
|
2020-03-05 17:20:45 -05:00
|
|
|
],
|
|
|
|
plugins: [
|
|
|
|
'lodash',
|
|
|
|
'@babel/plugin-syntax-dynamic-import',
|
2021-01-10 20:26:35 -05:00
|
|
|
['@babel/plugin-proposal-class-properties', { loose: true }],
|
|
|
|
['@babel/plugin-proposal-optional-chaining', { loose: true }],
|
|
|
|
['@babel/plugin-proposal-private-methods', { loose: true }],
|
2021-07-26 12:30:35 -04:00
|
|
|
['@babel/plugin-proposal-nullish-coalescing-operator', { loose: true }],
|
2020-03-05 17:20:45 -05:00
|
|
|
['@babel/plugin-transform-runtime', { corejs: 3 }],
|
2020-03-19 17:57:39 -04:00
|
|
|
'react-hot-loader/babel',
|
2020-03-05 17:20:45 -05:00
|
|
|
],
|
|
|
|
env: {
|
|
|
|
// Setup a different config for tests as they run in node instead of a browser
|
|
|
|
test: {
|
|
|
|
presets: [
|
|
|
|
[
|
|
|
|
'@babel/preset-env',
|
|
|
|
{
|
|
|
|
useBuiltIns: 'usage',
|
|
|
|
corejs: 3,
|
|
|
|
loose: true,
|
|
|
|
shippedProposals: true,
|
|
|
|
modules: 'commonjs',
|
2020-03-19 17:57:39 -04:00
|
|
|
targets: { node: 'current' },
|
2020-03-05 17:20:45 -05:00
|
|
|
},
|
|
|
|
],
|
2021-04-13 18:26:02 -04:00
|
|
|
['@emotion/babel-preset-css-prop'],
|
2020-03-05 17:20:45 -05:00
|
|
|
],
|
|
|
|
plugins: ['babel-plugin-dynamic-import-node'],
|
|
|
|
},
|
2020-04-17 02:35:01 -04:00
|
|
|
// build instrumented code for testing code coverage with Cypress
|
|
|
|
instrumented: {
|
|
|
|
plugins: ['istanbul'],
|
|
|
|
},
|
2020-10-27 00:16:02 -04:00
|
|
|
production: {
|
|
|
|
plugins: [
|
|
|
|
[
|
|
|
|
'babel-plugin-jsx-remove-data-test-id',
|
|
|
|
{
|
|
|
|
attributes: 'data-test',
|
|
|
|
},
|
|
|
|
],
|
|
|
|
],
|
|
|
|
},
|
2021-08-09 12:11:26 -04:00
|
|
|
testableProduction: {
|
|
|
|
plugins: [],
|
|
|
|
},
|
2020-03-05 17:20:45 -05:00
|
|
|
},
|
|
|
|
};
|