generated from hamlim/template-react-library
-
Notifications
You must be signed in to change notification settings - Fork 0
/
babel.config.js
44 lines (43 loc) · 1.08 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
module.exports = function (api) {
api.cache.using(() => process.env.NODE_ENV)
let cfg = ['@babel/preset-env', { bugfixes: true }]
if (process.env.NODE_ENV === 'test') {
cfg = [
'@babel/preset-env',
{
targets: {
node: 8,
},
},
]
}
return {
presets: [cfg, '@babel/preset-react'],
plugins: [
'babel-plugin-styled-components',
'@babel/plugin-transform-runtime',
'@babel/plugin-proposal-export-default-from',
[
'@babel/plugin-transform-typescript',
{
// force typescript to support jsx in all files no matter the extension I guess
isTSX: true,
allExtensions: true,
allowDeclareFields: true,
onlyRemoveTypeImports: true,
},
],
],
ignore:
process.env.NODE_ENV !== 'test'
? [
'src/test.js',
'src/test.tsx',
'src/__tests__/*.js',
'src/__tests__/*.tsx',
'src/__fixtures__/**/*.js',
'src/__fixtures__/**/*.tsx',
]
: [],
}
}