-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbabel.config.js
More file actions
70 lines (64 loc) · 1.65 KB
/
Copy pathbabel.config.js
File metadata and controls
70 lines (64 loc) · 1.65 KB
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
65
66
67
68
69
70
/**
* 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-react',
[
'@babel/preset-env',
{
debug: false,
modules: false,
},
],
]
const plugins = [
'@babel/plugin-transform-computed-properties',
'@babel/plugin-proposal-export-namespace-from', // to use 'exports * as ...'
'@babel/plugin-transform-runtime',
'@babel/plugin-syntax-object-rest-spread',
'@babel/plugin-transform-object-assign',
'@babel/plugin-transform-destructuring',
['@babel/plugin-proposal-decorators', { decoratorsBeforeExport: true }],
// plugin-proposal-class-properties must be placed before 'plugin-proposal-decorators'
// See https://babeljs.io/docs/en/next/babel-plugin-proposal-decorators.html
['@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,
}
}