diff --git a/docusaurus/docs/advanced-configuration.md b/docusaurus/docs/advanced-configuration.md index 1b817529409..27b51d61747 100644 --- a/docusaurus/docs/advanced-configuration.md +++ b/docusaurus/docs/advanced-configuration.md @@ -18,3 +18,4 @@ You can adjust various development and production settings by setting environmen | GENERATE_SOURCEMAP | 🚫 Ignored | ✅ Used | When set to `false`, source maps are not generated for a production build. This solves OOM issues on some smaller machines. | | NODE_PATH | ✅ Used | ✅ Used | Same as [`NODE_PATH` in Node.js](https://nodejs.org/api/modules.html#modules_loading_from_the_global_folders), but only relative folders are allowed. Can be handy for emulating a monorepo setup by setting `NODE_PATH=src`. | | INLINE_RUNTIME_CHUNK | 🚫 Ignored | ✅ Used | By default, Create React App will embed the runtime script into `index.html` during the production build. When set to `false`, the script will not be embedded and will be imported as usual. This is normally required when dealing with CSP. | +| DISABLE_CONSOLE_CLEARING | ✅ Used | ✅ Used | When set to `true`, the terminal won't get cleared | diff --git a/packages/react-dev-utils/README.md b/packages/react-dev-utils/README.md index d89dc95f667..f8e119c6e47 100644 --- a/packages/react-dev-utils/README.md +++ b/packages/react-dev-utils/README.md @@ -158,7 +158,7 @@ if ( #### `clearConsole(): void` -Clears the console, hopefully in a cross-platform way. +Clears the console, hopefully in a cross-platform way. Can be disabled with setting `DISABLE_CONSOLE_CLEARING=true` in your environment ```js var clearConsole = require('react-dev-utils/clearConsole'); diff --git a/packages/react-dev-utils/clearConsole.js b/packages/react-dev-utils/clearConsole.js index 2099a57ec35..f44a474dff9 100644 --- a/packages/react-dev-utils/clearConsole.js +++ b/packages/react-dev-utils/clearConsole.js @@ -8,6 +8,9 @@ 'use strict'; function clearConsole() { + if (process.env.DISABLE_CONSOLE_CLEARING === 'true') { + return; + } process.stdout.write( process.platform === 'win32' ? '\x1B[2J\x1B[0f' : '\x1B[2J\x1B[3J\x1B[H' );