Skip to content

HMR with webpack #897

Closed
Closed
@f0rr0

Description

@f0rr0

Description

HMR does not work.

Expected behavior

import React from 'react';
import ReactDOM from 'react-dom';
import App from './components/App';
import './index.css';

ReactDOM.render(
  <App />,
  document.getElementById('root')
);

if (module.hot) {
  module.hot.accept('./components/App', () => {
    ReactDOM.render(
      <App />,
      document.getElementById('root')
    );
  });
}

Hot updates should refresh page.

Actual behavior

Nothing happens.

see webpack/webpack-dev-server#206

https://github.com/facebookincubator/create-react-app/blob/88c15d0988fcb456fc976cbe15823ed518470126/packages/react-scripts/scripts/start.js#L221 uses hot option and https://github.com/facebookincubator/create-react-app/blob/88c15d0988fcb456fc976cbe15823ed518470126/packages/react-scripts/config/webpack.config.dev.js#L206 uses the plugin.

Removing either solved it for me.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions