1 В избранное 0 Ответвления 0

OSCHINA-MIRROR/mirrors_trending-forem

Присоединиться к Gitlife
Откройте для себя и примите участие в публичных проектах с открытым исходным кодом с участием более 10 миллионов разработчиков. Приватные репозитории также полностью бесплатны :)
Присоединиться бесплатно
Клонировать/Скачать
babel.config.js 2.5 КБ
Копировать Редактировать Web IDE Исходные данные Просмотреть построчно История
Mac Siri Отправлено 25.01.2024 23:29 afa73e0
/* eslint-env node */
module.exports = function (api) {
var validEnv = ['development', 'test', 'production'];
var currentEnv = api.env();
var isDevelopmentEnv = api.env('development');
var isProductionEnv = api.env('production');
var isTestEnv = api.env('test');
var isEndToEnd = process.env.E2E === 'true';
if (!validEnv.includes(currentEnv)) {
throw new Error(
'Please specify a valid `NODE_ENV` or ' +
'`BABEL_ENV` environment variables. Valid values are "development", ' +
'"test", and "production". Instead, received: ' +
JSON.stringify(currentEnv) +
'.',
);
}
return {
presets: [
(isProductionEnv || isDevelopmentEnv || isTestEnv) && [
'@babel/preset-env',
{
modules: false,
targets: { browsers: '> 1%' },
useBuiltIns: 'entry',
corejs: { version: 3, proposals: false },
exclude: ['transform-regenerator'],
bugfixes: true,
forceAllTransforms: true,
},
'preact',
],
].filter(Boolean),
plugins: [
isEndToEnd && ['istanbul'],
'@babel/plugin-syntax-dynamic-import',
isTestEnv && '@babel/plugin-transform-modules-commonjs',
'@babel/plugin-transform-destructuring',
[
'@babel/plugin-proposal-class-properties',
{
spec: true,
loose: true,
},
],
[
'@babel/plugin-proposal-object-rest-spread',
{
useBuiltIns: true,
},
],
[
'@babel/plugin-transform-private-property-in-object',
{
loose: true,
},
],
[
'@babel/plugin-transform-private-methods',
{
loose: true,
},
],
[
'@babel/plugin-transform-react-jsx',
{
pragma: 'h',
},
],
[
'inline-react-svg',
{
svgo: {
plugins: [
{
name: 'preset-default',
params: {
overrides: {
removeViewBox: false,
},
},
},
],
},
},
],
[
'module-resolver',
{
// Only the @images webpack alias is here because it's being used by a
// Babel plugin before webpack runs in the frontend build pipeline.
alias: {
'@images': './app/assets/images/',
},
},
],
].filter(Boolean),
};
};

Опубликовать ( 0 )

Вы можете оставить комментарий после Вход в систему

1
https://api.gitlife.ru/oschina-mirror/mirrors_trending-forem.git
git@api.gitlife.ru:oschina-mirror/mirrors_trending-forem.git
oschina-mirror
mirrors_trending-forem
mirrors_trending-forem
main