forked from VirtueMe/oai-pmh
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.babelrc.js
74 lines (72 loc) · 1.48 KB
/
.babelrc.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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
// Based on build config from https://dev.to/remshams/rolling-up-a-multi-module-system-esm-cjs-compatible-npm-library-with-typescript-and-babel-3gjg
const shared = {
ignore: [ 'src/**/*.test.js' ],
plugins: [
[ 'module-resolver', {
root: [ './src' ],
alias: {
'package.json': './package.json',
},
} ],
],
};
const sharedPresetEnv = {
useBuiltIns: 'usage',
// This should match the current LTS version of Node.js, and correspond to the engine version in package.json
targets: 'maintained node versions',
corejs: 3,
};
module.exports = {
env: {
test: {
...shared,
ignore: [],
plugins: [[ 'module-resolver', {
alias: {
'~/package.json': './package.json',
},
} ]],
presets: [[ '@babel/env', {
...sharedPresetEnv,
modules: 'commonjs',
} ]],
},
esm: {
...shared,
plugins: [[ 'module-resolver', {
alias: {
'lodash': 'lodash-es',
'~/package.json': '../package.json',
},
} ]],
presets: [[ '@babel/env', {
...sharedPresetEnv,
modules: false,
} ]],
},
cjs: {
...shared,
plugins: [[ 'module-resolver', {
alias: {
'~/package.json': '../package.json',
},
} ]],
presets: [[ '@babel/env', {
...sharedPresetEnv,
modules: 'commonjs',
} ]],
},
bin: {
plugins: [[ 'module-resolver', {
alias: {
'~/src': './cjs',
'~/package.json': '../package.json',
},
} ]],
presets: [[ '@babel/env', {
...sharedPresetEnv,
modules: 'commonjs',
} ]],
},
},
};