knex/babel.config.js
Igor Savin 093f7227b5 Use Babel 7 (#2813)
* WIP changes

* Use Babel 7

* Fix build

* Fix Node 6 compatibility (apparently Babel has no idea how to transform Object.values)

* Try ignoring "expected behaviour" error (https://github.com/babel/babel-loader/issues/152)

* Coverage dropped since less code gets generated now, time to revisit threshold
2018-09-26 23:11:30 +03:00

23 lines
480 B
JavaScript

'use strict';
const isDev = process.env.npm_lifecycle_event === 'dev';
module.exports = function(api) {
const presets = [
[
'@babel/preset-env',
Object.assign(
{},
isDev ? { targets: { node: 'current' } } : { targets: { node: 6 } }
),
],
];
const plugins = ['add-module-exports'];
api.cache(() => process.env.NODE_ENV); // Invalidate cache when building for a different environment
return {
presets,
plugins,
};
};