question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Hot reloading isn't working as expected

See original GitHub issue

Describe 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:

  1. yarn add global react-static
  2. react-static create
  3. Select Emotion example
  4. 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:closed
  • Created 5 years ago
  • Comments:6

github_iconTop GitHub Comments

1reaction
Pixelatexcommented, Nov 29, 2018

Hey @corysimmons I looked into it and seems like a fix is to change your .babelrc to include the hot reload module.

{
  "extends": "react-static/.babelrc",
  "plugins": ["babel-plugin-emotion",
    "react-hot-loader/babel"]
}

For me it worked 😃 Can you give it a try? + you should only need to hot() in the app.js, not on your components.

0reactions
corysimmonscommented, Nov 30, 2018

Maybe the react-static create is targetting an older version of the Emotion template? 🤔

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found