forked from graphql/graphiql
-
Notifications
You must be signed in to change notification settings - Fork 0
/
babel.config.js
42 lines (38 loc) · 1.03 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
// for ESM don't transpile modules
const envConfig = {
modules: 'commonjs',
};
if (process.env.ESM) {
envConfig.modules = false;
envConfig.targets = { node: true };
envConfig.bugfixes = true;
}
if (process.env.CDN) {
envConfig.modules = 'umd';
envConfig.targets = null;
}
module.exports = {
presets: [
[require.resolve('@babel/preset-env'), envConfig],
require.resolve('@babel/preset-react'),
require.resolve('@babel/preset-typescript'),
],
env: {
test: {
presets: [
[require.resolve('@babel/preset-env'), envConfig],
[require.resolve('@babel/preset-react'), { runtime: 'automatic' }],
require.resolve('@babel/preset-typescript'),
],
plugins: [require.resolve('babel-plugin-macros')],
},
development: {
compact: false,
},
},
plugins: [
require.resolve('@babel/plugin-proposal-class-properties'),
require.resolve('@babel/plugin-proposal-nullish-coalescing-operator'),
require.resolve('@babel/plugin-proposal-optional-chaining'),
],
};