-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathbabel.config.js
More file actions
25 lines (22 loc) · 942 Bytes
/
babel.config.js
File metadata and controls
25 lines (22 loc) · 942 Bytes
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
// Constants.
const { default: { version: CORE_JS_VERSION } } = await import('core-js-pure/package.json', { with: { type: 'json' } })
const { default: { version: RUNTIME_VERSION } } = await import('@babel/runtime-corejs3/package.json', { with: { type: 'json' } })
/**
* @param {import('@babel/core').ConfigAPI} [API]
* @returns {import('@babel/core').TransformOptions}
*/
export default function configurateBabel(API) {
API?.assertVersion('^7.29.0')
API?.cache.never()
return {
presets: Object.entries({
'@babel/preset-env': { bugfixes: true, targets: { node: 'current' }, modules: false },
'@babel/preset-typescript': {},
}),
plugins: Object.entries({
'babel-plugin-polyfill-corejs3': { method: 'usage-pure', version: CORE_JS_VERSION, proposals: true },
'@babel/plugin-proposal-decorators': { version: '2023-11' },
'@babel/plugin-transform-runtime': { regenerator: false, version: RUNTIME_VERSION },
}),
}
}