generated from tjx666/awesome-chrome-extension-boilerplate
-
Notifications
You must be signed in to change notification settings - Fork 30
/
babel.config.js
48 lines (45 loc) · 1.46 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
39
40
41
42
43
44
45
46
47
48
module.exports = (api) => {
api.cache(true);
const envPreset = [
'@babel/env',
{
// 不注释这一行jest运行会报错
// modules: false,
bugfixes: true,
useBuiltIns: 'usage',
corejs: { version: require('./package.json').devDependencies['core-js'] },
},
];
// const importPlugin = [
// 'import',
// {
// libraryName: 'antd',
// libraryDirectory: 'es',
// style: true,
// },
// ];
return {
presets: ['@babel/preset-typescript', envPreset],
plugins: [
'@babel/plugin-proposal-class-properties',
'@babel/plugin-transform-runtime',
['@babel/plugin-proposal-decorators', { decoratorsBeforeExport: true }],
'lodash',
// importPlugin,
],
env: {
development: {
presets: [['@babel/preset-react', { runtime: 'automatic', development: true }]],
plugins: [require.resolve('react-refresh/babel')],
},
production: {
presets: [['@babel/preset-react', { runtime: 'automatic', development: false }]],
plugins: ['@babel/plugin-transform-react-constant-elements'],
},
test: {
presets: ['@babel/preset-react'],
plugins: ['transform-es2015-modules-commonjs'],
},
},
};
};