-
Notifications
You must be signed in to change notification settings - Fork 0
/
babel.config.cjs
30 lines (29 loc) · 1.23 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
//======================================================================================================================
// For now, this must be a CommonJS module. ECMAScript modules cause @babel/eslint-parser to become
// asynchronous, which ESLint does not support: https://github.com/eslint/eslint/discussions/14295
//======================================================================================================================
module.exports = {
plugins: [
['@babel/plugin-syntax-import-attributes', {deprecatedAssertSyntax: true}],
process.env.ENV == 'jest'
&& ['replace-import-extension', {extMapping: {'.js': '', '.jsx': '', '.ts': '', '.tsx': ''}}]
].filter(Boolean),
presets: [
['@babel/preset-env', {
corejs: 3,
modules: process.env.ENV == 'jest' ? 'auto' : false,
targets: [
'last 2 Chrome versions',
'last 2 Edge versions',
'last 2 Firefox versions, Firefox ESR',
'last 2 Safari versions',
'maintained node versions'
],
useBuiltIns: 'usage'
}],
['@babel/preset-typescript', {
allowDeclareFields: true, // TODO: will be enabled by default in Babel 8
rewriteImportExtensions: true // .?(c|m)ts?(x) → .?(c|m)js
}]
]
};