generated from hamlim/template-react-library
-
Notifications
You must be signed in to change notification settings - Fork 0
/
babel.config.js
40 lines (39 loc) · 953 Bytes
/
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
module.exports = function (api) {
api.cache.using(() => process.env.NODE_ENV)
let cfg = [
'@babel/preset-env',
{
targets: {
node: true,
},
},
]
return {
presets: [cfg, '@babel/preset-react'],
plugins: [
'babel-plugin-styled-components',
'@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',
]
: [],
}
}