4
votes

React hot reload is not working. In webpack entry, I have following code.

entry: {
        home: [
            'webpack-dev-server/client?http://0.0.0.0:8000', 
            'webpack/hot/dev-server', // add "only-dev-server" prevents reload on syntax errors
            path.join(__dirname, 'app/home-styles.js')
        ],
        main: [
            'babel-polyfill',
            path.join(__dirname, 'app/styles.js'),
            path.join(__dirname, 'app/vendor.js'),
            path.join(__dirname, 'app/index.js')
        ]
    },

and in dev-server I have hot = true;

and i have below code for wrapping Provider in hot

class Root extends Component {
    render() {
        const { store, history } = this.props;
        return (
            <Provider store={store}>
                <Router history={history} routes={routes(store)}/>
            </Provider>
        );
    }
}

export default hot(module)(Root);

This is result in console, but nothing happens when there is some change. So basically it appears as if hot reload is working but.. no changes reflects. What am I missing here. ? enter image description here

I am using react 16.2.* and react-hot-loader @4.0.* an webpack @4.5.*

1
did you ever find a solution to this issue? i'm having a very similar oneClark T.
no.. i decided to ignore it for now.. will look into it later.. if you ever find one ..please comment :P you can set bounty to question.. someone will answer then :PUchit Kumar
Are you using webpack Dev server?Clark T.
yes we are using webpack Dev Server. why?Uchit Kumar
Do you access your application from the IP or map it to a domain?Clark T.

1 Answers

0
votes

try updating your dev server config like so

const devServerOptions = {
    contentBase: './dist',
    hot: true,
    host: 'beta.whenidev.net',
    https: true,
  };
// if you're adding a dev server entry do it like this
  WebpackDevServer.addDevServerEntrypoints(config, devServerOptions);