-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbabel.config.js
50 lines (50 loc) · 1.25 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
49
50
module.exports = function (api) {
api.cache.using(() => process.env.NODE_ENV);
const isProd = api.env("production");
return {
presets: [
[
"@babel/preset-react",
{
runtime: "automatic",
},
],
"@babel/preset-typescript",
[
"@babel/preset-env",
{
targets: {
// Target browsers supporting ES Modules, comment this block to use .browserslistrc
esmodules: true,
},
modules: false, // true for transformation of ES6 module syntax to another module type.
loose: true, // true mean not strict to es5
useBuiltIns: "usage", // imports for polyfills when they are used in each file
corejs: 3,
},
],
"@linaria",
],
plugins: [
[
"babel-plugin-macros",
{
twin: {
styled: {
import: "styled",
from: "@linaria/react",
},
css: {
import: "css",
from: "@linaria/core",
},
global: {
import: "css",
from: "@linaria/core",
},
},
},
],
].concat(isProd ? [] : ["react-refresh/babel"]),
};
};