-
-
Notifications
You must be signed in to change notification settings - Fork 15
/
Copy pathbabel.config.cjs
46 lines (38 loc) · 1.26 KB
/
babel.config.cjs
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
// @ts-check
'use strict';
const { deepMergeConfig } = require('@-xun/symbiote/assets');
const {
assertEnvironment,
moduleExport
} = require('@-xun/symbiote/assets/babel.config.cjs');
const { createDebugLogger } = require('rejoinder');
const debug = createDebugLogger({ namespace: 'symbiote:config:babel' });
module.exports = deepMergeConfig(
moduleExport({
derivedAliases: getBabelAliases(),
...assertEnvironment({ projectRoot: __dirname })
}),
{
// Any custom configs here will be deep merged with moduleExport's result
}
);
// TODO: delete this
if (process.env.EXTERNAL_DELETE_THIS) {
// @ts-expect-error: delete all of this
module.exports.env['production-cjs'].plugins[0][1].replaceExtensions[
'^../test/util.js$'
] = './util.js';
}
debug('exported config: %O', module.exports);
function getBabelAliases() {
// ! These aliases are auto-generated by symbiote. Instead of modifying them
// ! directly, consider regenerating aliases across the entire project with:
// ! `npx symbiote project renovate --regenerate-assets --assets-preset ...`
return {
'^rootverse:(.+)$': './$1',
'^universe:(.+)$': './src/$1',
'^universe$': './src/index.js',
'^testverse:(.+)$': './test/$1',
'^typeverse:(.+)$': './types/$1'
};
}