-
Notifications
You must be signed in to change notification settings - Fork 31
/
Copy pathbabel.config.js
63 lines (57 loc) · 1.58 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
/**
* Copyright 2017–2018, LaborX PTY
* Licensed under the AGPL Version 3 license.
*/
/**
* This is config for Babel 7.x
*
* See info
* https://babeljs.io/docs/en/configuration
* https://babeljs.io/docs/en/config-files#6x-vs-7x-babelrc-loading
*/
module.exports = (api) => {
api.cache(true)
const presets = [
'@babel/preset-env',
'@babel/preset-react',
]
const plugins = [
'@babel/transform-flow-strip-types',
'@babel/plugin-transform-runtime',
'@babel/plugin-transform-computed-properties',
'@babel/plugin-proposal-export-namespace-from', // to use 'exports * as ...'
'@babel/plugin-syntax-object-rest-spread',
'@babel/plugin-transform-object-assign',
'@babel/plugin-transform-destructuring',
// plugin-proposal-class-properties must be placed AFTER 'plugin-proposal-decorators'
// See https://babeljs.io/docs/en/next/babel-plugin-proposal-decorators.html
['@babel/plugin-proposal-decorators', { 'legacy': true }],
['@babel/plugin-proposal-class-properties', { loose: false }],
'@babel/plugin-proposal-export-default-from',
'@babel/plugin-proposal-throw-expressions',
[
'react-css-modules',
{
handleMissingStyleName: 'throw',
generateScopedName: '[name]__[local]___[hash:base64:5]',
filetypes: {
'.scss': {
syntax: 'postcss-scss',
},
},
},
],
'react-hot-loader/babel',
]
const overrides = [
{
test: ['./config'],
presets: [['@babel/preset-env']],
},
]
return {
presets,
plugins,
overrides,
}
}