-
-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathbabel.config.js
37 lines (36 loc) · 1.03 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
const { resolvePath } = require('babel-plugin-module-resolver');
module.exports = function (api) {
api.cache.using(
() => process.env.NODE_ENV + process.env.BROWSERSLIST_ENV + '5',
);
const options = { loose: true, hasJsxRuntime: true };
if (process.env.NODE_ENV === 'test') {
options.resolver = {
resolvePath(sourcePath, currentFile, opts) {
if (
sourcePath.startsWith('.') &&
(sourcePath.endsWith('.js') || sourcePath.endsWith('.cjs'))
) {
const removedExt = sourcePath.substring(
0,
sourcePath.lastIndexOf('.'),
);
return resolvePath(removedExt, currentFile, opts);
}
},
root: [],
};
}
return {
presets: [['@anansi', options]],
assumptions: {
noDocumentAll: true,
noClassCalls: true,
constantReexports: true,
objectRestNoSymbols: true,
pureGetters: true,
},
// allows us to load .babelrc in addition to this
babelrcRoots: ['packages/*', 'examples/*'],
};
};