Created
November 19, 2021 08:36
-
-
Save widyakumara/e32816b38ca26ab2078162a739ec7e82 to your computer and use it in GitHub Desktop.
disable console.* on production
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if (env === 'production') { | |
const noop = () => {} | |
['assert', 'clear', 'count', 'debug', 'dir', 'dirxml', 'error', | |
'exception', 'group', 'groupCollapsed', 'groupEnd', 'info', 'log', | |
'markTimeline', 'profile', 'profileEnd', 'table', 'time', 'timeEnd', | |
'timeline', 'timelineEnd', 'timeStamp', 'trace', 'warn', | |
].forEach((method) => { | |
window.console[method] = noop | |
}) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment