-
Notifications
You must be signed in to change notification settings - Fork 0
/
babel.config.cjs
43 lines (41 loc) · 1012 Bytes
/
babel.config.cjs
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
"use strict";
const IS_TEST_ENV = process.env.NODE_ENV === "test";
module.exports = {
plugins: [
!IS_TEST_ENV && [
"babel-plugin-add-import-extension",
{
extension: "js",
}
],
].filter(Boolean),
presets: [
IS_TEST_ENV && [
"@babel/preset-env",
{
// "bugfixes" will be enabled by default in Babel 8.
bugfixes: true,
corejs: 3,
modules: "commonjs",
useBuiltIns: "entry",
// Jest doesn't support ES Modules because of custom `require()` hooks.
// Jest runs all tests on Node and in JSDOM
targets: {
node: "current",
},
}
],
IS_TEST_ENV && [
"@babel/preset-react",
{
// This toggles behavior specific to development, such as adding __source and __self.
development: true,
// Decides which runtime to use:
// - `automatic` auto imports the functions that JSX transpiles to.
// - `classic` does not automatic import anything.
runtime: "automatic",
}
],
"@babel/preset-typescript",
].filter(Boolean)
};