status-x/babel.config.js

46 lines
879 B
JavaScript
Raw Permalink Normal View History

/* global module */
module.exports = function (api) {
const node = {
ignore: [],
plugins: [
'babel-plugin-macros',
[
'@babel/plugin-proposal-decorators', {
legacy: true
}
],
'@babel/plugin-syntax-dynamic-import',
'babel-plugin-dynamic-import-node',
[
'@babel/plugin-proposal-class-properties', {
loose: true
}
],
'@babel/plugin-proposal-optional-chaining',
[
'@babel/plugin-transform-runtime', {
corejs: 2
}
]
],
presets: [
[
'@babel/preset-env', {
targets: {
node: '8.11.3'
}
}
],
'@babel/preset-typescript'
]
};
switch (api.env()) {
case 'node':
return node;
default:
throw new Error(`invalid babel env: ${api.env}`);
}
};