-
Notifications
You must be signed in to change notification settings - Fork 0
/
babel.config.js
35 lines (34 loc) · 1.1 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
const { isLiveReload, isProductionPipeline } = require('./envConditions');
module.exports = {
presets: [
// Preset ordering is reversed (last to first).
[
'@babel/preset-env',
{
bugfixes: true, // will be enabled by default in Babel 8
modules: false,
},
],
'@babel/preset-react',
'@babel/preset-typescript',
],
plugins: [
['@babel/plugin-proposal-decorators', { version: 'legacy' }],
'@babel/plugin-transform-runtime',
/**
* note: @babel/plugin-proposal-class-properties is enabled by default
* in @babel/preset-env, but removing it breaks the build due to changing
* the order of initialization class properties and parameter properties.
* @see https://github.com/babel/babel/issues/13779
* @see https://github.com/microsoft/TypeScript/issues/45995
*/
'@babel/plugin-proposal-class-properties',
isLiveReload && require.resolve('react-refresh/babel'),
isProductionPipeline && [
'babel-plugin-react-remove-properties',
{
properties: ['data-test'],
},
],
].filter(Boolean),
};