Closed WickedSik closed 6 years ago
Babel.js
{
"presets": [
"es2015",
"react",
"stage-2"
],
"plugins": [
"syntax-dynamic-import",
"transform-decorators-legacy",
"transform-object-rest-spread",
"react-hot-loader/babel"
],
"env": {
"test": {
"plugins": [
"transform-decorators-legacy",
"transform-object-rest-spread",
"istanbul"
]
}
}
}
I did a little test.
Old:
App = connect(mapStateToProps, mapDispatchToProps)(App);
export default hot(module)(App)
New:
if(module.hot) {
module.hot.accept();
}
export default App
This does compile well (I presume module.hot
doesn't exist), and runs on the page, but modules aren't reloaded.
You are not using the good version of React Hot Loader. hot
is only available since v4. Upgrade react-hot-loader
and it should work.
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:
When runnin
npm run hot
(cross-env NODE_ENV=development node_modules/webpack-dev-server/bin/webpack-dev-server.js --inline --hot --config=node_modules/laravel-mix/setup/webpack.config.js
) it compiles fine:DONE Compiled successfully in 14861ms
.However when I got to the page, I get greeted by an error in the console and a blank page.
Expected behavior
What you think should happen:
A working HMR situation 😄
Actual behavior
What actually happens:
The above error.
Environment
React Hot Loader version: 3.1.3
Run these commands in the project folder and fill in their results:
node -v
: 8.1.3npm -v
: 5.6.0Then, specify:
Reproducible Demo
Unfortunately I am not at liberty to share the code we're using, so I must take a raincheck on this. However, I can tell the following:
We're running laravel v5.5 + mix v1.7.2 + react v15.6.2
webpack.mix.js
Relevant code: