-
Notifications
You must be signed in to change notification settings - Fork 20
/
.babelrc.js
50 lines (46 loc) · 1.24 KB
/
.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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
const namespace = process.env.SC_NAMESPACE;
const plugins = [
'@babel/plugin-proposal-class-properties',
'babel-plugin-annotate-pure-calls',
'@babel/plugin-transform-react-constant-elements',
];
const ignore = ['**/*.d.ts', '**/helpers', '**/__helpers', '**/*.stories.tsx'];
process.env.EMOTION
? plugins.push([
'@emotion/babel-plugin',
{
autoLabel: 'always',
labelFormat: `${namespace}__[local]`,
},
])
: plugins.push([
'babel-plugin-styled-components',
{
displayName: false,
namespace,
},
]);
process.env.COVERAGE && plugins.push(['babel-plugin-istanbul']);
module.exports = {
env: {
cjs: {
presets: ['@babel/preset-env', '@babel/preset-react', '@babel/preset-typescript'],
plugins,
ignore,
},
esm: {
presets: [
[
'@babel/preset-env',
{
modules: false,
},
],
'@babel/preset-react',
'@babel/preset-typescript',
],
plugins,
ignore,
},
},
};