soapbox/babel.config.cjs

48 wiersze
919 B
JavaScript
Czysty Zwykły widok Historia

2020-03-28 00:35:00 +00:00
module.exports = (api) => {
const env = api.env();
const envOptions = {
debug: false,
modules: false,
useBuiltIns: 'usage',
2023-01-23 21:22:10 +00:00
corejs: '3.27',
2020-03-28 00:35:00 +00:00
};
const config = {
presets: [
'@babel/react',
'@babel/typescript',
2020-03-28 00:35:00 +00:00
['@babel/env', envOptions],
],
plugins: [
['react-intl', { messagesDir: './build/messages/' }],
2020-03-28 00:35:00 +00:00
'preval',
],
'sourceType': 'unambiguous',
2020-03-28 00:35:00 +00:00
};
switch (env) {
2022-05-11 21:06:35 +00:00
case 'production':
config.plugins.push(...[
'@babel/transform-react-inline-elements',
[
'@babel/transform-runtime',
{
helpers: true,
regenerator: false,
useESModules: true,
},
],
]);
break;
case 'test':
config.plugins.push(...[
'transform-require-context',
]);
envOptions.modules = 'commonjs';
break;
2020-03-28 00:35:00 +00:00
}
return config;
};