-
Notifications
You must be signed in to change notification settings - Fork 801
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Updated module requires browser refresh #515
Comments
Having a similar issue with a similar environment:
All things look good when I make a change:
|
@rpoitras const element = (
<AppContainer errorReporter={consoleErrorReporter}>
...
</AppContainer>
)
if (module.hot) {
module.hot.accept("components/Base", () => {
ReactDOM.render(element, document.getElementById(domNodeId))
})
} to const renderApp = Component => {
const element = (
<AppContainer errorReporter={consoleErrorReporter}>
...
</AppContainer>
)
ReactDOM.render(element, document.getElementById(domNodeId))
}
if (module.hot) {
module.hot.accept("components/Base", () => { renderApp(App) })
} And But these seem fine on your branch. But your entry files are a bit different from those working boilerplates. Try to put You can try to follow this demo (the most helpful one AFAIC) as much as possible. I guess everyone did something wrong differently. But the actual problem here is the logging. It would be nice if it's possible to log some errors in such situations. |
Thanks for the suggestion @retroalgic. I just tried it. But the behaviour remained the same. I'll look closer at the demo you linked. Maybe I'll see something. |
@retroalgic I have basically the same setup in both the // in webpack.config.js
webpackConfig.entry = {
js: env.prod ? [
'babel-polyfill',
PATHS.app // main index.js app entry point
] : [
'react-hot-loader/patch',
'webpack-dev-server/client?http://' + HOST + ':' + DEV_SERVER_PORT,
'webpack/hot/only-dev-server',
'babel-polyfill',
PATHS.app
],
...
webpackConfig.plugins = [
new webpack.HotModuleReplacementPlugin(),
new webpack.NamedModulesPlugin(),
...
webpackConfig.devServer = {
hot: true,
...
// package.json
...
"scripts": {
"start": "webpack-dev-server --host 0.0.0.0 --progress --env.dev --watch-poll",
... |
@rpoitras |
I had the same issue. I solved it by requiring the module again as described here: if (module.hot) {
module.hot.accept('./App', () => {
const NextApp = require('js/App').default;
ReactDom.render(
... |
@Anima-t3d |
@retroalgic thanks, my @Anima-t3d I've tried that before with no luck. But I thought I don't recall using that implementation with a setup that included Still does not work with Thank both of you so much. I've spent countless hours trying to get this to work. |
This can be closed, example in this working demo |
@rpoitras This is my
|
@Anima-t3d I'm using: {
"presets": [
"airbnb",
["es2015", {"modules": false}],
"react",
"stage-2"
],
"plugins": [
"transform-class-properties",
"react-hot-loader/babel"
]
} |
@rpoitras I hope, it's solved now, thanks guys for your help! |
Ah, I saw it with |
Able to get it working by requiring the module again:
However, the changes do not get applied on the fly. I need to go back to a different component and then come back to a changed component to see the changes. Anyway, this is way better than a full page refresh and losing the entire application state. Thanks to @Anima-t3d for the tip. |
@vraa - you forget to update a local variable App = require("./containers/app"); Require by it own does not do anything. |
Description
JSX changes not triggering browser update.
Expected behavior
Make changes to some JSX while webpack dev-server is running. Changes are detected. App recompiles. Browser is updated with changes without a full refresh.
Actual behavior
Make changes to some JSX while webpack dev-server is running. Changes are detected. App recompiles. Browser does not update. Changes are reflected only if the browser is refreshed.
Environment
React Hot Loader version: 3.0.0-beta.6
node -v
: v7.5.0npm -v
: 4.1.2Reproducible Demo
https://github.com/rpoitras/sample-app (with react-router 3.0.2)
https://github.com/rpoitras/sample-app/tree/react-router-4 (with react-router 4.0.0)
The text was updated successfully, but these errors were encountered: