Created
August 26, 2017 21:06
-
-
Save jaredpalmer/8cd6a535e0db0cc4dea6bba22c052aee to your computer and use it in GitHub Desktop.
Change the port in CRA's WebpackHotDevClient.
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 fs = require('fs'); | |
// Monkey-patch react-dev-utils to get the error overlay with SSR | |
const pathToDevClient = 'node_modules/react-dev-utils/webpackHotDevClient.js'; | |
// The react-scripts default | |
const reactScriptsPort = 3000; | |
// Read the dev client out of node_modules | |
const HotDevClient = fs.readFileSync(pathToDevClient, 'utf8'); | |
// Switch out the socket port. | |
fs.writeFileSync( | |
pathToDevClient, | |
HotDevClient.replace('window.location.port', 3000) | |
); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment