-
Notifications
You must be signed in to change notification settings - Fork 116
/
babel.config.js
52 lines (50 loc) · 1.15 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
51
52
module.exports = {
env: {
// ESM Build
esm: {
exclude: ["node_modules/**"],
presets: [
[
"@babel/preset-env",
{
modules: false, // Code is written as ES2015 - no need to transform modules
},
],
"@babel/preset-react",
],
plugins: [
"@babel/plugin-proposal-class-properties",
[
"transform-react-remove-prop-types",
{
mode: "unsafe-wrap",
ignoreFilenames: ["node_modules"],
},
],
],
},
// CommonJs build
cjs: {
exclude: ["node_modules/**"],
presets: [
[
"@babel/preset-env",
{
modules: "commonjs", // Transform modules to CommonJs
},
],
"@babel/preset-react",
],
plugins: [
"@babel/plugin-proposal-class-properties",
[
"transform-react-remove-prop-types",
{
mode: "unsafe-wrap", // Wrap propTypes in condition to remove by webpack in production build
ignoreFilenames: ["node_modules"],
},
],
],
},
},
};