-
Notifications
You must be signed in to change notification settings - Fork 28
Expand file tree
/
Copy pathbabel.config.js
More file actions
40 lines (38 loc) · 871 Bytes
/
babel.config.js
File metadata and controls
40 lines (38 loc) · 871 Bytes
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
module.exports = ({ env }) => {
const isTest = env() === 'test';
// This babel config is used for our component tests (jest, react-testing-library)
if (isTest) {
return {
presets: [
[
'next/babel',
{
'preset-react': {
runtime: 'automatic',
importSource: '@emotion/react',
},
},
],
],
plugins: ['@emotion/babel-plugin'],
};
}
// This babel config is used for everything else which include: NPM package bundles, docs/template site (nextjs), storybook and playroom
return {
presets: [
['@babel/preset-env', { targets: { node: 'current' } }],
'@babel/preset-typescript',
'@emotion/babel-preset-css-prop',
[
'next/babel',
{
'preset-react': {
runtime: 'automatic',
importSource: '@emotion/react',
},
},
],
],
plugins: ['@emotion/babel-plugin'],
};
};