-
Notifications
You must be signed in to change notification settings - Fork 0
/
babel.config.js
47 lines (42 loc) · 1022 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
41
42
43
44
45
46
47
const getBaseConfig = () => ({
presets: [
[
'@babel/preset-env',
{
debug: false,
// modules: false,
// useBuiltIns: 'usage',
// corejs: 3,
targets: {
node: 'current',
browsers: ['ie 11', '>0.15%', 'not dead', 'not op_mini all'],
},
},
],
'@babel/preset-react',
],
plugins: [
['babel-plugin-styled-components', { fileName: false }],
['@babel/plugin-transform-runtime', { corejs: 3 }],
'@babel/plugin-syntax-dynamic-import',
],
})
module.exports = (api) => {
api.cache(true)
const baseConfig = getBaseConfig()
if (process.env.NODE_ENV !== 'test') {
baseConfig.ignore = [
'**/__snapshots__/**',
'**/*.test.js',
'**/*.test.jsx',
'**/*.test.ts',
'**/*.test.tsx',
]
// If not in tests, add the babel assets import plugin
baseConfig.plugins.push([
'transform-assets-import-to-string',
{ baseDir: '/assets' },
])
}
return baseConfig
}