-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbabel.config.js
64 lines (63 loc) · 1.73 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
//@flow
module.exports = {
plugins: [
'@babel/plugin-proposal-class-properties',
'@babel/plugin-proposal-object-rest-spread',
'@babel/syntax-dynamic-import',
],
presets: ['@babel/react', '@babel/flow'],
overrides: [
/**
* REMOVE ME: This override is needed to make sure that we only run the emotion's
* babel plugin on components that need it. Without it every component will
* have emotion included in their bundle.
* Ticket: https://ecosystem.atlassian.net/browse/AK-6065
*/
{
test: [
'./packages/core/drawer',
'./packages/core/global-navigation',
'./packages/core/lozenge',
'./packages/core/modal-dialog',
'./packages/core/navigation-next',
'./packages/core/select',
'./packages/core/textfield',
],
presets: ['@emotion/babel-preset-css-prop'],
},
],
env: {
'production:cjs': {
plugins: [
'@babel/transform-runtime',
['styled-components', { minify: false }],
'transform-dynamic-import',
],
presets: [['@babel/env', { modules: 'commonjs' }]],
ignore: [
'**/__mocks__',
'**/__tests__',
'**/__fixtures__',
'node_modules',
],
},
'production:esm': {
plugins: [
'@babel/transform-runtime',
['styled-components', { minify: false }],
],
presets: [['@babel/env', { modules: false }]],
ignore: [
'**/__mocks__',
'**/__tests__',
'**/__fixtures__',
'node_modules',
],
},
test: {
presets: ['@babel/env'],
// There is no @babel/ scoped transform for this plugin
plugins: ['transform-dynamic-import', '@babel/transform-runtime'],
},
},
};