Hot reloading isn't working as expected
See original GitHub issueDescribe the bug
I can wrap every single component export in hot(module)(MyComponent)
and it works. If I don’t (i.e. if I just wrap my outermost App
component), then hot reloading doesn’t work.
To Reproduce Steps to reproduce the behavior:
yarn add global react-static
react-static create
- Select Emotion example
- Create a simple component and try to update its styles
Expected behavior Styles hot reload
Desktop (please complete the following information):
- OS: iOS
- Browser: Chrome
Additional context I’m using the latest versions of react-static and react-hot-loader as mentioned here: https://github.com/nozzle/react-static/issues/397
It’s possible my extending of the Babel config is causing the issue:
// .babelrc
{
"extends": "react-static/.babelrc",
"env": {
"production": {
"plugins": [["emotion", { "sourceMap": false }]]
},
"development": {
"plugins": [
["emotion", { "sourceMap": true, "labelFormat": "[filename]--[local]" }]
]
}
}
}
// package.json
{
"scripts": {
"start": "NODE_ENV=development react-static start",
"stage": "react-static build --staging",
"build": "NODE_ENV=production react-static build",
"serve": "serve dist -p 3000"
},
"dependencies": {
"@fortawesome/fontawesome-svg-core": "^1.2.8",
"@fortawesome/pro-light-svg-icons": "^5.5.0",
"@fortawesome/pro-regular-svg-icons": "^5.5.0",
"@fortawesome/pro-solid-svg-icons": "^5.5.0",
"@fortawesome/react-fontawesome": "^0.1.3",
"axios": "^0.16.2",
"emotion": "^9.2.12",
"polished": "^2.3.0",
"react": "^16.7.0-alpha.2",
"react-dom": "^16.7.0-alpha.2",
"react-emotion": "^9.2.12",
"react-router": "^4.3.1",
"react-static": "^5.9.12"
},
"devDependencies": {
"@fortawesome/fontawesome-pro": "^5.5.0",
"babel-plugin-emotion": "^9.2.4",
"emotion-server": "^9.2.12",
"eslint-config-react-tools": "^1.1.6",
"prop-types": "15.x",
"react-hot-loader": "^4.3.12",
"serve": "^6.1.0"
},
"private": true
}
Issue Analytics
- State:
- Created 5 years ago
- Comments:6
Top Results From Across the Web
Unable to Hot Reload on Visual Studio 2022 - Stack Overflow
Press the Hot Reload icon in the toolbar, then Settings from the icon's context menu (or access via Tools > Settings > Debugging)...
Read more >Hot reload not working - Visual Studio Feedback
I'm trying to use Hot Reload on Android Emulador, but when I do any change in XAML file, the app doesn't update. Looking...
Read more >Hot reload not working as expected · Issue #3519 - GitHub
When I try to hot reload on VS Code, it says 'Restarted application' but nothing changes on the device! It's only after I...
Read more >Anyone else having huge problems with VS 2022 and Hot ...
When they backed up, it doesn't seem they committed to releasing production-quality Hot Reload. They just released it in whatever broken state ...
Read more >react-hot-loader - npm
If you use a not-yet-friendly library, like react-async-component, or are having problems with hot reloading failing to reload code-split ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Hey @corysimmons I looked into it and seems like a fix is to change your .babelrc to include the hot reload module.
For me it worked 😃 Can you give it a try? + you should only need to hot() in the app.js, not on your components.
Maybe the
react-static create
is targetting an older version of the Emotion template? 🤔