initial commit
This commit is contained in:
38
.babelrc.js
Normal file
38
.babelrc.js
Normal file
@@ -0,0 +1,38 @@
|
||||
const Environment = {
|
||||
development: "development",
|
||||
production: "production",
|
||||
};
|
||||
|
||||
module.exports = (api) => {
|
||||
const presets = [
|
||||
[
|
||||
"@babel/preset-env",
|
||||
{
|
||||
useBuiltIns: "usage",
|
||||
debug: false,
|
||||
corejs: 3,
|
||||
},
|
||||
],
|
||||
"@babel/preset-react",
|
||||
];
|
||||
const plugins = [
|
||||
"@babel/plugin-syntax-dynamic-import",
|
||||
];
|
||||
|
||||
const environment = api.cache.using(() => {
|
||||
const env = process.env.NODE_ENV ?? Environment.production;
|
||||
return env;
|
||||
});
|
||||
console.log(`Current environment: '${environment}'`);
|
||||
switch (environment) {
|
||||
case Environment.development:
|
||||
plugins.push("react-refresh/babel");
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return {
|
||||
presets,
|
||||
plugins,
|
||||
};
|
||||
};
|
||||
Reference in New Issue
Block a user