forked from Sage/carbon
-
Notifications
You must be signed in to change notification settings - Fork 0
/
babel.config.js
33 lines (31 loc) · 918 Bytes
/
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
const inProduction = process.env.NODE_ENV === "production";
const inStorybookBuild = process.env.STORYBOOK_BUILD === "true";
module.exports = (api) => {
const useCJSModules = api.env(["test", "cjs"]);
return {
presets: [
[
"@babel/preset-env",
{
useBuiltIns: "usage",
targets: {
browsers:
"last 2 Chrome versions, last 2 Firefox versions, last 2 Edge versions, last 2 Safari versions",
},
corejs: "3.20",
modules: useCJSModules ? "auto" : false,
},
],
"@babel/preset-react",
"@babel/preset-typescript",
],
plugins: [
!inStorybookBuild &&
inProduction &&
"./plugins/generate-proptypes/index.mjs",
"@babel/plugin-proposal-class-properties",
"@babel/plugin-transform-classes",
"babel-plugin-dev-expression",
].filter(Boolean),
};
};