-
Notifications
You must be signed in to change notification settings - Fork 5
/
babel.config.js
83 lines (76 loc) · 2.08 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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
module.exports = api => {
api.cache.using(() => process.env.NODE_ENV)
const defaultAlias = {
"@totalsoft/zion": "@totalsoft/zion/src",
"@totalsoft/pure-validations": "@totalsoft/pure-validations/src",
"@totalsoft/rules-algebra": "@totalsoft/rules-algebra/src",
"@totalsoft/react-state-lens": "@totalsoft/react-state-lens/src",
"@totalsoft/change-tracking": "@totalsoft/change-tracking/src",
"@totalsoft/change-tracking-react": "@totalsoft/change-tracking-react/src",
"@totalsoft/change-tracking-react/lensProxy": "@totalsoft/change-tracking-react/src/lensProxy",
};
// const presets = api.env("test")
// ? [
// [
// "@babel/preset-env",
// {
// targets: { node: "current" }
// }
// ]
// ]
// : [];
const defaultPlugins = [["@babel/plugin-proposal-pipeline-operator", { proposal: "minimal" }], "@babel/plugin-proposal-optional-chaining"];
// const plugins = api.env("test")
// ? [
// ...defaultPlugins,
// [
// "babel-plugin-module-resolver",
// {
// root: ["./"],
// alias: defaultAlias
// }
// ]
// ]
// : [...defaultPlugins, ["@babel/plugin-transform-modules-commonjs"]];
return {
plugins: defaultPlugins,
env: {
cjs: {
presets: [
[
"@babel/preset-env",
{
modules: "commonjs"
}
]
],
plugins: [["@babel/plugin-transform-runtime"]]
},
esm: {
plugins: [["@babel/plugin-transform-runtime", { useESModules: true }]]
},
test: {
presets: [
["@babel/preset-react", {
"runtime": "automatic"
}],
[
"@babel/preset-env",
{
targets: { node: "current" }
}
]
],
plugins: [
[
"babel-plugin-module-resolver",
{
root: ["./"],
alias: defaultAlias
}
]
]
}
}
};
};