Closed KingBarbarian closed 6 years ago
Try using the following code,but still won't do
if (module.hot) {
const NextApp = require('@/routers').default;
module.hot.accept('@/routers', () => { render(NextApp) })
}
AppContainer must be top most container.
@theKashey It doesn't respond
ReactDOM.render(
<AppContainer>
<Provider store={configureStore()}>
<Component />
</Provider>
</AppContainer>,
document.getElementById("app")
);
You seem to be missing react-hot-loader/babel
as a babel plugin
I am having the same issue. If I run react@15.6.2
with react-dom@15.6.2
, it works just fine; if I update those to 16.0.0
, I get the same scenario as above. The console shows no errors or warnings, nor does the webpack output, and it says App is up to date
but nothing changes. My project is based off react-slingshot
and my package.json and webpack.config.dev.js match what is available in react-slingshot
on this commit: https://github.com/coryhouse/react-slingshot/commit/70850e3fe0ea9d746c14554774c5454ce1da7951, with the exception of updating react-hot-loader
to 3.1.3 (though 3.0.0-beta.6 fails also)
For now, I'm rolling back to react v15 but would love to update to v16!
PS: react-slingshot is using RHL's webpack-plugin. This is not related to this issue, as long it might cause only state loss, not nothing, but they should move to babel plugin.
If someone could provide any reproducible example - I'll be very excited.
I totally admit that I don't speak webpack or babel, but react-slingshot is using babel, and using babel-loader
for jsx files, not react-hot-loader/webpack
per the documentation. I don't think it's using RHL's webpack plugin ...
{
test: /\.jsx?$/,
exclude: /node_modules/,
use: ['babel-loader']
},
I'll see if I can trim my code down to something I can share and still replicate the issue.
@nloding - Yep, I did a mistake - saw react-hot-loader/patch in webpack.conf and thing about loader. Any way - I could not find where babel plugin is attached. PS: It is not related to this issue.
@theKashey true, there is no plugin in the babel config. I've added it to mine and it still doesn't work. I'm not sure why it isn't related, as I'm seeing the exact same issue. The console outputs [HMR] App up to date
and lists the updated module, but nothing is actually updated. But only when I'm using react@16.0.0
, it works fine with react@15.6.2
. Is it not related because the configs are slightly different? The behavior I'm seeing is the same. I'm happy to open a separate issue if needed.
Did you update react-mount as well? Will be components updated, if you will work
with them (aka updated by normal React update cycle).
Here's my deps:
"dependencies": {
"aphrodite": "~1.2.3",
"axios": "~0.16.2",
"bootstrap": "~4.0.0-beta",
"immutable": "~3.8.1",
"lodash": "~4.17.4",
"moment": "~2.18.1",
"object-assign": "~4.1.0",
"oidc-client": "~1.3.0",
"prop-types": "15.5.10",
"react": "15.6.2",
"react-bootstrap-typeahead": "~2.0.0",
"react-dom": "15.6.2",
"react-moment": "~0.6.5",
"react-quill": "~1.1.0",
"react-redux": "~5.0.5",
"react-router-dom": "4.2.2",
"react-router-redux": "5.0.0-alpha.6",
"reactstrap": "~4.8.0",
"redux": "~3.6.0",
"redux-form": "~7.0.4",
"redux-oidc": "~3.0.0-beta.14",
"redux-thunk": "~2.1.0"
},
"devDependencies": {
"autoprefixer": "7.1.4",
"babel-cli": "6.24.1",
"babel-core": "6.25.0",
"babel-eslint": "7.2.3",
"babel-jest": "20.0.3",
"babel-loader": "7.1.1",
"babel-plugin-transform-react-constant-elements": "6.23.0",
"babel-plugin-transform-react-remove-prop-types": "0.4.6",
"babel-polyfill": "6.23.0",
"babel-preset-env": "1.6.0",
"babel-preset-react": "6.24.1",
"babel-preset-react-hmre": "1.1.1",
"babel-preset-stage-1": "6.24.1",
"browser-sync": "2.18.12",
"chalk": "2.0.1",
"concurrently": "3.5.0",
"connect-history-api-fallback": "1.3.0",
"copy-webpack-plugin": "4.2.3",
"coveralls": "2.13.1",
"css-loader": "0.28.7",
"enzyme": "3.0.0",
"enzyme-adapter-react-16": "1.0.0",
"eslint": "4.2.0",
"eslint-plugin-import": "2.7.0",
"eslint-plugin-react": "7.3.0",
"eslint-watch": "3.1.2",
"extract-text-webpack-plugin": "3.0.1",
"file-loader": "0.11.2",
"history": "4.6.0",
"html-webpack-plugin": "2.29.0",
"identity-obj-proxy": "3.0.0",
"jest": "20.0.4",
"jest-cli": "20.0.4",
"json-loader": "0.5.4",
"mockdate": "2.0.1",
"node-sass": "4.5.3",
"opn-cli": "3.1.0",
"postcss-loader": "2.0.6",
"prompt": "1.0.0",
"prop-types": "15.5.10",
"raf": "3.3.2",
"react-hot-loader": "3.1.3",
"react-test-renderer": "16.0.0",
"redux-immutable-state-invariant": "2.0.0",
"replace": "0.3.0",
"rimraf": "2.6.1",
"sass-loader": "6.0.6",
"style-loader": "0.19.0",
"url-loader": "0.5.9",
"webpack": "3.1.0",
"webpack-bundle-analyzer": "2.8.2",
"webpack-dev-middleware": "1.11.0",
"webpack-hot-middleware": "2.18.2",
"webpack-md5-hash": "0.0.5"
},
If I update react
and react-dom
to 16.0.0
or higher, it fails; it works with the versions you see above.
At this point it seems like HMR is swallowing some sort of error. Is there any way to increase the verbosity, or get some additional debugging statements out of it? If I throw a console.log
in the module.hot.accept
callback, it doesn't get called with v16 but does with v15, for instance.
this is not depends on version of React or RHL
Do I need to look at webpack-hot-middleware
then, if it's not RHL?
The best way - just provide a reproducible demo.
@nloding Can you please try next version, set up is simplified and it works better with React 16 and ES6 code. Feel free to reopen a new issue if you experienced some problems.
@neoziro will do, thanks. I'll update next week and report a new bug if issues persist.
If you are reporting a bug or having an issue setting up React Hot Loader, please fill in below. For feature requests, feel free to remove this template entirely.
Description
What you are reporting: HMR start-up success but page no update , please help!🌹
Expected behavior
What you think should happen: page update
Actual behavior
What actually happens: logs
Environment
React Hot Loader version:
3.0.0-beta.7
Run these commands in the project folder and fill in their results:
node
:v6.11.3
npm
:v3.10.10
webpack
:v3.5.6
webpack-dev-server
:v2.9.2
redux
:v3.7.2
react-redux
:v5.0.6
Then, specify:
macOS Sierra 10.12.6
chrome
Reproducible Demo
webpack.dev.conf.js
.babelrc
main.js