-
Notifications
You must be signed in to change notification settings - Fork 40
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ui: fix hot reloading for docker and bare metal
Hot reloading is broken in react-scripts, more information: facebook/create-react-app#11879
- Loading branch information
Daniel Arnauer
committed
Mar 22, 2022
1 parent
1011208
commit 9e8c671
Showing
3 changed files
with
32 additions
and
2 deletions.
There are no files selected for viewing
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
// Copied from https://github.com/facebook/create-react-app/issues/11879 | ||
// This is obsolete when this issue has been resolved | ||
|
||
const fs = require("fs"); | ||
const path = require("path"); | ||
|
||
if (process.env.NODE_ENV === "development") { | ||
const webPackConfigFile = path.resolve("./node_modules/react-scripts/config/webpack.config.js"); | ||
let webPackConfigFileText = fs.readFileSync(webPackConfigFile, "utf8"); | ||
|
||
if (!webPackConfigFileText.includes("watchOptions")) { | ||
if (webPackConfigFileText.includes("performance: false,")) { | ||
webPackConfigFileText = webPackConfigFileText.replace( | ||
"performance: false,", | ||
"performance: false,\n\t\twatchOptions: { aggregateTimeout: 200, poll: 1000, ignored: '**/node_modules', }," | ||
); | ||
fs.writeFileSync(webPackConfigFile, webPackConfigFileText, "utf8"); | ||
} else { | ||
throw new Error(`Failed to inject watchOptions`); | ||
} | ||
} | ||
} |
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