Skip to content

Commit

Permalink
🧱 remove console on production build only
Browse files Browse the repository at this point in the history
keeps console for Jest runs but not for Storybook (which appears to use ESM production build)
  • Loading branch information
json2d committed Mar 21, 2024
1 parent c5118e5 commit e974fcd
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 3 deletions.
3 changes: 0 additions & 3 deletions .babelrc

This file was deleted.

16 changes: 16 additions & 0 deletions .babelrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
module.exports = function(api) {
const isDev = api.caller(
caller => caller && caller.target === 'node' && caller.isDev
);

const plugins = [];

if (!isDev) {
// Only add the transform-remove-console plugin in production
plugins.push('transform-remove-console');
}

return {
plugins,
};
};

0 comments on commit e974fcd

Please sign in to comment.