forked from date-fns/date-fns
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.babelrc.js
30 lines (26 loc) · 939 Bytes
/
.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
const presets = ['@babel/preset-typescript']
const plugins = [
'@babel/plugin-transform-block-scoping',
'@babel/plugin-transform-template-literals',
'@babel/plugin-transform-arrow-functions',
'@babel/plugin-transform-parameters',
'@babel/plugin-transform-destructuring',
'@babel/plugin-proposal-optional-chaining',
'@babel/plugin-proposal-class-properties',
'@babel/plugin-proposal-object-rest-spread',
'@babel/plugin-transform-shorthand-properties',
'@babel/plugin-proposal-nullish-coalescing-operator',
]
if (process.env.BABEL_ENV !== 'esm') {
plugins.push('@babel/plugin-transform-modules-commonjs')
plugins.push('babel-plugin-add-module-exports')
}
if (process.env.BABEL_ENV === 'esm' || process.env.BABEL_ENV === 'commonjs') {
plugins.push(['babel-plugin-add-import-extension', { extension: 'js' }])
}
const overrides = [{ ignore: ['**/*.d.ts'] }]
module.exports = {
presets,
plugins,
overrides,
}