-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
Hot update not update the view (screen) #100
Comments
The react-hot-loader only works for React components. Is |
Yes it is the react-router with a sample react component. |
I test it before on one port with a webpack dev only server, and it worked, then splitted it into 2 servers and got the problem. Or is it possible to redirect router paths to |
The log looks pretty good... It does't look like a connection/configuration issue. cc @gaearon |
Can you put up a reproducible example in a repo so I could examine it? |
Funny, i create an example with the code above, everything worked. Hope it was the update of chrome that solved the problem and it is no other strange problem. |
Reopened the problem. I try my app at my office computer and got the problem. At home i run Win7 Host with a VirtualBox Mint 17 and it worked without a problem in the box. Did somebody have an idea how i can determine the problem? |
Any change you have duplicate |
cleaned node_modules dir and install all modules new. |
Does https://github.com/gaearon/react-hot-boilerplate work on that computer? |
Thanks, found the problem: apparmor blocked something on port 8080. (previously i run a docker project and uninstalled docker) Funny problem, script compilation run and browser message for reload appears, only the browser view not update thats why it was not obvious what was not working. |
Good, thank you for sharing! |
I see the same problem @rottmann , how can I fix it?
|
@bobzhang did you find a solution? I am seeing the same problem. |
I ran into the same problem yesterday. Any information on how to fix that? @mikealexander Did you find a solution for your problem? |
I have this same problem, anyone help |
Same problem, the browser received the I tried to execute the code which is in the |
Okay, I solved this problem by STOP USING
CHANGE TO
|
Did anyone find a solution? |
I also met this problem, and I solved it by change import { AppContainer } from 'react-hot-loader';
import App from 'js/App';
if (module.hot) {
module.hot.accept('./App', () => {
ReactDom.render(
<AppContainer>
<App />
</AppContainer>,
document.getElementById('root'),
);
});
} to import { AppContainer } from 'react-hot-loader';
import App from 'js/App';
if (module.hot) {
module.hot.accept('./App', () => {
const NextApp = require('js/App').default;
ReactDom.render(
<AppContainer>
<NextApp />
</AppContainer>,
document.getElementById('root'),
);
});
} Seems the App won't refresh it self, so we need to re-import it, also need to make sure import it after(or say inside) the Hope it helps :) |
Thanks @Armour. I followed https://webpack.js.org/guides/hmr-react/ which says "Note that because webpack 2 has built-in support for ES2015 modules, you won't need to re-require your root component in module.hot.accept" but the browser did not update the view. After "re-requiring" the component within the |
Thanks @Armour, it works well!
|
I have the same problem, there is interesting solution which use "self-accepting",
|
I'm also experiencing this issue. I've asked a question on StackOverflow which can be seen here: http://stackoverflow.com/questions/43491310/cant-get-webpack-2-hmr-react-to-work This works for me:
This also works for me:
This doesn't:
Why doesn't the default setup work? Really confused. |
Had the same issue since this morning and this fixed it ! |
I had the same issue and it boils down to how module code generation works in your setup (through Babel/TypeScript). From my limited understanding, webpack 2 should be able to inject the {
"target": "es6",
// "module": Don't override this to anything
"moduleResolution": "node",
} I remember reading about a
|
@ssynix I'm also using typescript (2.2.2) and I can't seem to get react-hot-loader@next it to work following the https://github.com/gaearon/react-hot-loader/tree/master/docs#webpack-2 example as @davincho did. Re-requiring the app in the hot reload handler works, as does just calling module.hot.accept(), but I'd like to get it working as documented. As I think @ssynix is right "it boils down to how module code generation works in your setup", I've been trying a number of different settings without much luck (would like to take advantage of tree shaking).
|
This works for me too, in the angular app. Thanks so much~~~ |
I struggled with this for a bit with Webpack 3 and got it working with the import() syntax. Not sure if this is helpful to anyone but here's what's working for me:
|
@swxy
|
I had this issue and for me the underlying problem was misconfigured babel presets. presets: [
[ 'es2015', { modules: false } ],
'stage-0',
'react',
] After (The usual approach now works): presets: [
[ 'env', { modules: false } ],
'react',
] I think options to a preset can be overriden by other presets, in this case presumably stage-0 also turned the modules transform back on. Source: https://stackoverflow.com/questions/43491310/cant-get-webpack-2-hmr-react-to-work/43500626 |
Thanks @hedgepigdaniel. Its mentioned in the react-hot-loader doc here, that
|
I finally got this working after 5+ hours looking through many different github issues and tutorials. First off, versions for what I'm using currently:
Two things helped resolve this issue and have the browser reload on source code change:
People said that they did not include this property in their
entry: {
hmr_endpoint: 'webpack-dev-server/client?http://localhost:8008'
} Whatever you name it doesn't matter. including it in an array works as well; just be wary of mismatching types if you are doing this all through Node's api like I am. entry: [
'webpack-dev-server/client?http://localhost:8008'
] Obviously change the port to whichever one you are working with in your project. |
@tiodot 's solution worked with Typescript + React but failed with Redux and Redux Saga Integrated. |
I wrote a little react app and serve static files from a separate express server (to redirect all sub-pathes to index.html [react-router]).
static server on port 8080
webpack hot dev server on port 8081
Browser console log:
after modify and save a file (e.g. router.js)
But on the screen nothing change
The cli console log show:
Structure
package.json
webpack.base.js
dev-server-js
app.js
Is it a problem when serving the index.html from an other port?
The docs say it is possible (http://webpack.github.io/docs/webpack-dev-server.html#combining-with-an-existing-server)
The text was updated successfully, but these errors were encountered: