2019-12-08 02:48:30 +05:30
|
|
|
/* eslint-env node */
|
2020-06-04 22:11:27 +05:30
|
|
|
// @ts-nocheck
|
|
|
|
module.exports = function (api) {
|
2020-06-05 20:54:41 +05:30
|
|
|
const env = api.env();
|
2020-10-11 22:03:55 +05:30
|
|
|
const isProduction = api.env((envName) => envName.includes('production'));
|
2020-06-04 22:11:27 +05:30
|
|
|
|
2020-10-11 22:03:55 +05:30
|
|
|
api.cache.using(() => env);
|
|
|
|
|
|
|
|
const browserEnv = {
|
|
|
|
plugins: ['react-hot-loader/babel'],
|
2020-06-04 22:11:27 +05:30
|
|
|
presets: [
|
|
|
|
[
|
2020-10-11 22:03:55 +05:30
|
|
|
'@babel/preset-env',
|
2020-06-04 22:11:27 +05:30
|
|
|
{
|
2020-10-11 22:03:55 +05:30
|
|
|
shippedProposals: true,
|
|
|
|
ignoreBrowserslistConfig: false,
|
|
|
|
modules: false,
|
|
|
|
useBuiltIns: 'usage', // or "entry"
|
|
|
|
corejs: 3,
|
|
|
|
include: ['proposal-class-properties'],
|
2020-05-27 15:37:25 +05:30
|
|
|
},
|
2020-06-04 22:11:27 +05:30
|
|
|
],
|
2020-10-11 22:03:55 +05:30
|
|
|
],
|
|
|
|
};
|
|
|
|
|
|
|
|
return {
|
|
|
|
presets: [
|
2020-06-04 22:11:27 +05:30
|
|
|
'@babel/preset-react',
|
|
|
|
[
|
|
|
|
'@babel/preset-env',
|
|
|
|
{
|
|
|
|
ignoreBrowserslistConfig: true,
|
|
|
|
targets: {
|
|
|
|
node: true,
|
|
|
|
},
|
|
|
|
modules: 'commonjs',
|
|
|
|
},
|
|
|
|
],
|
2020-10-11 22:03:55 +05:30
|
|
|
[
|
|
|
|
// NOTE: preset-typescript must go before proposal-class-properties
|
|
|
|
// in order to use allowDeclareFields option
|
|
|
|
// proposal-class-properties is enabled by preset-env for browser env
|
|
|
|
// preset-env for nodejs does not need it, because recent node versions support class fields
|
|
|
|
//
|
|
|
|
// but, due to some bugs (?), we must place preset-typescript here so that it loads as
|
|
|
|
// last default preset, before loading browser presets.
|
|
|
|
// Only this combination is working without errors
|
|
|
|
'@babel/preset-typescript',
|
|
|
|
{
|
|
|
|
allowDeclareFields: true,
|
|
|
|
},
|
|
|
|
],
|
2020-05-27 15:37:25 +05:30
|
|
|
],
|
2020-06-04 22:11:27 +05:30
|
|
|
plugins: [
|
|
|
|
'@babel/plugin-syntax-dynamic-import',
|
|
|
|
'@babel/plugin-proposal-function-bind',
|
2020-07-20 17:26:47 +05:30
|
|
|
'@babel/plugin-proposal-optional-chaining',
|
2020-07-21 23:45:28 +05:30
|
|
|
'@babel/plugin-transform-runtime',
|
2020-06-04 22:11:27 +05:30
|
|
|
[
|
|
|
|
'react-intl-auto',
|
|
|
|
{
|
|
|
|
removePrefix: 'packages.app',
|
|
|
|
messagesDir: './build/messages/',
|
|
|
|
useKey: true,
|
2020-10-11 22:03:55 +05:30
|
|
|
removeDefaultMessage: isProduction,
|
2020-06-04 22:11:27 +05:30
|
|
|
},
|
|
|
|
],
|
2019-06-30 20:49:28 +05:30
|
|
|
],
|
2020-06-04 22:11:27 +05:30
|
|
|
env: {
|
2020-10-11 22:03:55 +05:30
|
|
|
browser: browserEnv,
|
|
|
|
'browser-development': browserEnv,
|
|
|
|
'browser-production': browserEnv,
|
2020-05-24 04:38:24 +05:30
|
|
|
},
|
2020-06-04 22:11:27 +05:30
|
|
|
};
|
2019-06-30 20:49:28 +05:30
|
|
|
};
|