Skip to content

Commit d0f8582

Browse files
SpaceK33zDaniel Figueiredo
authored and
Daniel Figueiredo
committed
Enable watchContentBase for webpack-dev-server (facebook#1546)
Resolves facebook#1508
1 parent f4effcf commit d0f8582

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed

packages/react-dev-utils/webpackHotDevClient.js

+4
Original file line numberDiff line numberDiff line change
@@ -252,6 +252,10 @@ connection.onmessage = function(e) {
252252
case 'ok':
253253
handleSuccess();
254254
break;
255+
case 'content-changed':
256+
// Triggered when a file from `contentBase` changed.
257+
window.location.reload();
258+
break;
255259
case 'warnings':
256260
handleWarnings(message.data);
257261
break;

packages/react-scripts/scripts/start.js

+2
Original file line numberDiff line numberDiff line change
@@ -249,6 +249,8 @@ function runDevServer(host, port, protocol) {
249249
// for some reason broken when imported through Webpack. If you just want to
250250
// use an image, put it in `src` and `import` it from JavaScript instead.
251251
contentBase: paths.appPublic,
252+
// By default files from `contentBase` will not trigger a page reload.
253+
watchContentBase: true,
252254
// Enable hot reloading server. It will provide /sockjs-node/ endpoint
253255
// for the WebpackDevServer client so it can learn when the files were
254256
// updated. The WebpackDevServer client is included as an entry point

0 commit comments

Comments
 (0)