-
Notifications
You must be signed in to change notification settings - Fork 0
/
babel.config.js
38 lines (36 loc) · 1.22 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
/* eslint-disable import/no-dynamic-require, global-require */
module.exports = api => {
const isProd = api.env('production');
const manifest = require(`./src/manifest.${isProd ? 'prod' : 'dev'}.json`) || {};
const chromeVersion = manifest.minimum_chrome_version || 'last 2 Chrome versions';
const envPreset = [
'@babel/env',
{
targets: { chrome: chromeVersion },
useBuiltIns: 'usage',
corejs: 3,
},
];
return {
presets: ['@babel/preset-typescript', envPreset],
plugins: [
'lodash',
'@babel/plugin-transform-runtime',
['import', { 'libraryName': 'antd', 'style': true }],
],
env: {
development: {
presets: [['@babel/preset-react', { development: true }]],
plugins: ['react-hot-loader/babel'],
},
production: {
presets: ['@babel/preset-react'],
plugins: [
'babel-plugin-dev-expression',
'@babel/plugin-transform-react-constant-elements',
'@babel/plugin-transform-react-inline-elements',
],
},
},
};
};