Skip to content

Commit

Permalink
chore: bump deps; add more babel syntax plugins
Browse files Browse the repository at this point in the history
  • Loading branch information
fmal committed Jan 2, 2020
1 parent 4e934c0 commit fe095e6
Show file tree
Hide file tree
Showing 8 changed files with 1,900 additions and 432 deletions.
2 changes: 2 additions & 0 deletions .browserslistrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
last 2 versions
IE > 10
36 changes: 31 additions & 5 deletions babel.config.js
Original file line number Diff line number Diff line change
@@ -1,20 +1,22 @@
'use strict'; // eslint-disable-line strict

const MIN_IE_VERSION = 11;

// eslint-disable-next-line import/no-commonjs
module.exports = api => {
const isTest = api.cache(() => process.env.NODE_ENV === 'test');
const babelEnv = api.cache(() => process.env.BABEL_ENV);
const isNodeTarget = api.cache(() => process.env.BABEL_TARGET === 'node');

const envTargets =
isTest || isNodeTarget ? { node: 'current' } : { ie: MIN_IE_VERSION };
const envTargets = isTest || isNodeTarget ? { node: 'current' } : undefined;

const envOpts = {
loose: true,
modules: babelEnv === 'cjs' || isTest ? 'commonjs' : false,
targets: envTargets
targets: envTargets,
exclude: [
'transform-typeof-symbol',
'transform-regenerator',
'transform-async-to-generator'
]
};

const presets = [['@babel/preset-env', envOpts], '@babel/preset-typescript'];
Expand All @@ -28,6 +30,30 @@ module.exports = api => {
useESModules: babelEnv === 'es'
}
],
!isNodeTarget && [
'@babel/plugin-transform-regenerator',
{
async: false
}
],
[
'transform-async-to-promises',
{
inlineHelpers: true
}
],
[
'@babel/plugin-proposal-optional-chaining',
{
loose: false
}
],
[
'@babel/plugin-proposal-nullish-coalescing-operator',
{
loose: false
}
],
babelEnv === 'cjs' && 'babel-plugin-add-module-exports'
].filter(Boolean);

Expand Down
Loading

0 comments on commit fe095e6

Please sign in to comment.