Last active
May 5, 2022 21:47
-
-
Save char0n/40bdff68805a7e3b86e35c417cc0b326 to your computer and use it in GitHub Desktop.
Create React App override for start script using rewire library
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
const path = require('path'); | |
const rewire = require('rewire'); | |
process.chdir(path.join(__dirname, '..')); | |
const start = rewire('react-scripts/scripts/start.js') | |
const configFactory = start.__get__('configFactory'); | |
const configFactoryMock = (webpackEnv) => { | |
const config = configFactory(webpackEnv); | |
// display errors for child compilations | |
config.stats = { | |
...config.stats, | |
children: true | |
}; | |
return config; | |
} | |
start.__set__('configFactory', configFactoryMock); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment