forked from prebid/Prebid.js
-
Notifications
You must be signed in to change notification settings - Fork 0
/
babelConfig.js
36 lines (33 loc) · 835 Bytes
/
babelConfig.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
let path = require('path');
function useLocal(module) {
return require.resolve(module, {
paths: [
__dirname
]
})
}
module.exports = function (options = {}) {
return {
'presets': [
[
useLocal('@babel/preset-env'),
{
'useBuiltIns': 'entry',
'corejs': '3.13.0',
// a lot of tests use sinon.stub & others that stopped working on ES6 modules with webpack 5
'modules': options.test ? 'commonjs' : 'auto',
}
]
],
'plugins': (() => {
const plugins = [
[path.resolve(__dirname, './plugins/pbjsGlobals.js'), options],
[useLocal('@babel/plugin-transform-runtime')],
];
if (options.codeCoverage) {
plugins.push([useLocal('babel-plugin-istanbul')])
}
return plugins;
})(),
}
}