2021-09-09 09:22:11 +07:00
|
|
|
const isCoverage = process.env.COVERAGE === "true";
|
|
|
|
const babelPlugins = isCoverage ? ["babel-plugin-istanbul"] : [];
|
2021-09-28 13:27:06 +07:00
|
|
|
const cracoPlugins = isCoverage
|
|
|
|
? [
|
|
|
|
{
|
|
|
|
plugin: require("craco-alias"),
|
|
|
|
options: {
|
|
|
|
source: "tsconfig",
|
|
|
|
baseUrl: "./src",
|
|
|
|
tsConfigPath: "./tsconfig.aliases.json",
|
|
|
|
},
|
|
|
|
},
|
|
|
|
]
|
|
|
|
: [
|
|
|
|
{
|
|
|
|
plugin: require("craco-alias"),
|
|
|
|
options: {
|
|
|
|
source: "tsconfig",
|
|
|
|
baseUrl: "./src",
|
|
|
|
tsConfigPath: "./tsconfig.aliases.json",
|
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
|
|
|
plugin: require("craco-esbuild"),
|
|
|
|
options: {
|
|
|
|
enableSvgr: true,
|
|
|
|
esbuildMinimizerOptions: {
|
|
|
|
target: "es2015",
|
|
|
|
css: true,
|
|
|
|
minify: true,
|
|
|
|
},
|
|
|
|
skipEsbuildJest: true,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
];
|
2021-06-19 15:20:43 +07:00
|
|
|
|
2020-11-19 08:50:34 +07:00
|
|
|
module.exports = {
|
|
|
|
babel: {
|
2021-06-19 15:20:43 +07:00
|
|
|
plugins: babelPlugins,
|
|
|
|
},
|
2021-09-28 13:27:06 +07:00
|
|
|
plugins: cracoPlugins,
|
2021-06-19 15:20:43 +07:00
|
|
|
};
|