/
babel.config.js
35 lines (34 loc) · 1018 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
const { resolvePath } = require('babel-plugin-module-resolver');
module.exports = function (api) {
api.cache.using(() => process.env.NODE_ENV + process.env.BROWSERSLIST_ENV);
const options = { loose: 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/*'],
};
};