-
Notifications
You must be signed in to change notification settings - Fork 32
/
.babelrc.js
36 lines (34 loc) · 876 Bytes
/
.babelrc.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
module.exports = function(context) {
const env = context.cache(() => process.env.BABEL_ENV);
const isServer = env === "server";
let targets = {
"chrome": { chrome: 60 },
"edge": { edge: 14 },
"safari": { safari: 10 },
"firefox": { firefox: 54 },
"server": { node: 6 },
"fallback": {
browsers: ["last 2 versions", "ie >= 11", "safari >= 7"]
},
};
return {
presets: [
['@babel/env', {
targets: targets[env],
modules: isServer ? "commonjs" : false,
loose: isServer ? false : true,
// debug: true,
}]
],
plugins: [
["@babel/proposal-class-properties"],
["@babel/transform-block-scoping", {
"throwIfClosureRequired": true
}],
["@babel/transform-react-jsx", {
pragma: "React.createElement",
useBuiltIns: true
}]
]
};
};