Skip to content

Commit

Permalink
chore: target node 10 in babel
Browse files Browse the repository at this point in the history
  • Loading branch information
dbstratta committed Jun 6, 2020
1 parent f66fc3e commit 8d16e7e
Showing 1 changed file with 11 additions and 13 deletions.
24 changes: 11 additions & 13 deletions babel.config.js
Original file line number Diff line number Diff line change
@@ -1,28 +1,25 @@
module.exports = api => {
const babelEnv = api.env();

const debug = !!process.env.DEBUG_BABEL;
const useBuiltIns = false;

/* eslint-disable @typescript-eslint/no-unsafe-member-access, @typescript-eslint/no-unsafe-call */
module.exports = (api) => {
const presets = [
[
'@babel/preset-env',
{
targets: {
node: 8,
node: 10,
},
debug,
useBuiltIns,
debug: !!process.env.DEBUG_BABEL,
useBuiltIns: false,
bugfixes: true,
},
],
'@babel/preset-typescript',
];

const plugins = ['dynamic-import-node'];

const ignore = getIgnoredPaths(babelEnv);
const ignore = getIgnoredPaths(api);

const sourceMaps = babelEnv === 'production' ? true : 'inline';
const sourceMaps = api.env('production') ? true : 'inline';

return {
presets,
Expand All @@ -32,12 +29,13 @@ module.exports = api => {
};
};

function getIgnoredPaths(babelEnv) {
function getIgnoredPaths(api) {
const baseIgnorePaths = ['node_modules'];

if (babelEnv === 'production') {
if (api.env('production')) {
return [...baseIgnorePaths, '**/*.spec.ts', '**/*.test.ts', '**/*.d.ts'];
}

return baseIgnorePaths;
}
/* eslint-enable @typescript-eslint/no-unsafe-member-access, @typescript-eslint/no-unsafe-call */

0 comments on commit 8d16e7e

Please sign in to comment.