-
-
Notifications
You must be signed in to change notification settings - Fork 37
/
Copy pathbabel.config.js
72 lines (67 loc) · 1.85 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
const env = process.env.BABEL_ENV,
isUploadyBundle = process.env.UPLOADY_BUNDLE;
const productionConfig = {
plugins: [
//cant add to base because breaks unit-tests that modify process.env
"transform-inline-environment-variables",
]
};
const config = {
exclude: [
/utils\/isProduction/,
],
presets: [
[
"@babel/env",
{
// "loose": true,
"modules": env === "esm" ? false : "commonjs"
},
],
"@babel/react",
"@babel/flow",
],
plugins: [
"@babel/plugin-proposal-function-bind",
"@babel/plugin-proposal-export-default-from",
"babel-plugin-syntax-hermes-parser",
//adding these here to stop sb build from breaking on loose mode issue :(
"minify-dead-code-elimination",
["module-resolver", {
"root": ["./"],
// "alias": {}
}]
],
env: {
//cant use plugin when building storybook :(
production: isUploadyBundle ? productionConfig : undefined,
esm: productionConfig,
cjs: productionConfig,
test: {
plugins: [
"@babel/plugin-transform-runtime",
],
presets: [
[
"@babel/env",
{
targets: {
node: true,
},
},
],
],
},
}
};
module.exports = config;
// () => {
// console.log("!!!!!!!!! BABEL ENV ==== ", api.env());
// console.log("$$$$$$$$$$$$$$$$$$$$$$$$$$$ ", process.env.BUILD_TIME_VERSION)
//
// // api.caller((caller) => {
// // console.log("!!!!!!!!!!!!!!!!! BABEL CALLER !!!!!!!!!!!!!!! ", caller);
// // });
//
// return config;
// };