-
Notifications
You must be signed in to change notification settings - Fork 0
/
babel.config.js
48 lines (46 loc) · 1.78 KB
/
babel.config.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
37
38
39
40
41
42
43
44
45
46
47
48
'use strict'
module.exports = {
presets: [
[
// Automatically use the minimum set of syntax and polyfill transforms to
// meet target environment using browserslist config.
'@babel/preset-env',
{
// Transform modules to common js in test for Jest
// Disable module transformation in dev and prod builds to allow
// webpack to smart-manage modules.
modules: 'commonjs',
// Transforms the core-js and regenerator-runtime imports in index.js
// to only the polyfills needed for the target environments
useBuiltIns: 'entry',
// Configure core-js version used for polyfills. Do not automatically
// polyfill *proposals* with { version: 3, proposals: true }, if a
// consumer needs additional proposals polyfilled they can include them
// in the entry
corejs: 3,
},
],
// Enable TypeScript usage 🔐
'@babel/preset-typescript',
],
plugins: [
// Transform Runtime will transform inline Babel helper fns to imports from
// @babel/runtime
// Passing useESModules disables running helper imports through the common
// js module transform and allows webpack to manage the esm
// Passing corejs configs will use imports from @babel/runtime-corejs3
// instead of global polyfills (this should be set for libraries but is
// optional for applications)
// Do not set corejs, that will use module scoped polyfilled helpers, but
// env is polyfilled so we would double polyfill
[
'@babel/plugin-transform-runtime',
{
useESModules: false,
// https://github.com/babel/babel/issues/10261
// eslint-disable-next-line
version: require('@babel/helpers/package.json').version,
},
],
],
}