forked from buzz/mediainfo.js
-
Notifications
You must be signed in to change notification settings - Fork 0
/
babel.config.cjs
48 lines (42 loc) · 1.17 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
47
48
module.exports = (api) => {
api.cache(true)
const browserTarget = '> 0.25%, not dead'
const nodeTarget = { node: '4.4' }
const buildMixin = {
ignore: ['./__tests__', './**/*.d.ts'],
sourceMaps: 'inline',
}
return {
presets: [
['@babel/preset-env', { modules: 'commonjs', targets: nodeTarget }],
'@babel/preset-typescript',
],
ignore: ['./**/*.d.ts'],
sourceMaps: true,
env: {
// ESM build
ESM: {
presets: [['@babel/preset-env', { modules: false, targets: nodeTarget }]],
plugins: [
// Node.js ESM needs extensions in import statements
'babel-plugin-add-import-extension',
],
...buildMixin,
},
// CommonJS build
CJS: {
presets: [['@babel/preset-env', { modules: 'commonjs', targets: nodeTarget }]],
plugins: [
// Node.js CJS needs extensions in require statements
['babel-plugin-add-import-extension', { extension: 'cjs' }],
],
...buildMixin,
},
// Bundled esm
ESM_ROLLUP: {
presets: [['@babel/preset-env', { targets: browserTarget }]],
...buildMixin,
},
},
}
}