Skip to content

Conversation

morrow
Copy link

@morrow morrow commented Oct 17, 2018

Changes Made:

  • Update webpack configuration to specify output.publicPath with webpack port.
  • Update index to allow for re-rendering application on hot-reload.

Explanation:
The current bug is caused by webpack trying to retrieve hot-update.json data from localhost:5000/hot-update.json instead of localhost:5001/hot-update.json. This is fixed by updating the webpack configuration with a output.publicPath variable with the correct port number, retrieved using dotenv. Additionally, module.hot.accept and a renderApp function are added to index.js to re-render the app when changes are detected.

See: https://medium.com/@dan_abramov/hot-reloading-in-react-1140438583bf

Before:
image

... make some changes to client code ...

image

After:
image

... make some changes to client code ...

image

Update webpack configuration to specify output.publicPath with webpack port loaded from dotenv.
Update index to allow for re-rendering application on hot-reload.
Include NamedModulesPlugin to provide module names instead of numbers.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

1 participant