-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathbabel.config.js
40 lines (39 loc) · 1.1 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
const aliases = require('./aliases.config');
const resolveAlias = require('./resolveAlias');
module.exports = {
presets: [
[
'@babel/preset-env',
{
modules: process.env.BABEL_ENV === 'esm' ? false : 'commonjs',
},
],
'@babel/preset-react',
'@babel/preset-typescript',
],
env: {
debug: {
sourceMaps: 'inline',
retainLines: true,
},
esm: {
plugins: [['@babel/plugin-transform-runtime', { useESModules: true }]],
},
development: {
plugins: [
[
'module-resolver',
{
// https://github.com/tleunen/babel-plugin-module-resolver/issues/338
// There seem to be a bug with module-resolver under mono-repo setup:
// It doesn't resolve paths correctly when using root/alias combo, so we
// use this function instead.
// Will return undefined if not found in which case module-resolver will
// fallback on its default behaviour.
resolvePath: source => resolveAlias(source, aliases),
},
],
],
},
},
};