Skip to content

Instantly share code, notes, and snippets.

@AlexandrHoroshih
Created January 25, 2022 19:08
Show Gist options
  • Save AlexandrHoroshih/4f836363da3c7c3c09577d4364316cc9 to your computer and use it in GitHub Desktop.
Save AlexandrHoroshih/4f836363da3c7c3c09577d4364316cc9 to your computer and use it in GitHub Desktop.
const currentEnv = process.env.NODE_ENV || "prettier";
const withLogger = process.env.LOGGER === "true";
const babelPluginOverrides = {
prettier: {
presets: [
"@babel/preset-env",
"@babel/preset-react",
"@babel/preset-typescript",
],
},
production: {
presets: [],
plugins: [],
},
test: {
presets: [
"@babel/preset-env",
"@babel/preset-react",
"@babel/preset-typescript",
],
plugins: [
["@babel/plugin-proposal-private-methods", { loose: true }],
[
"transform-rename-import",
{
replacements: [
{ original: "effector-react$", replacement: "effector-react/ssr" },
{
original: "@effector/reflect$",
replacement: "@effector/reflect/ssr",
},
],
},
],
"effector/babel-plugin",
],
},
development: {
presets: [],
plugins: [
withLogger && "effector-logger/babel-plugin",
].filter(Boolean),
},
};
const presets = babelPluginOverrides[currentEnv || "production"].presets;
const plugins = babelPluginOverrides[currentEnv || "production"].plugins;
module.exports = {
presets,
plugins,
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment