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.

HMR not refreshing

See original GitHub issue

I think I have followed all the parts on the implementing react-native with HMR.

I’m getting the following logs: [Haul HMR] Client connected, however until you Enable Hot Reloading, you will not get any updates hotClient.js?485c:24 [Haul HMR] Bundle rebuilding hotClient.js?485c:24 [Haul HMR] Bundle rebuilt in 1158ms process-update.js?e13e:41 [HMR] Checking for updates on the server… process-update.js?e13e:114 [HMR] Updated modules: process-update.js?e13e:116 [HMR] - ./src/components/service-method-selection/service-method-page.tsx process-update.js?e13e:116 [HMR] - ./src/components/service-method-selection/index.ts process-update.js?e13e:116 [HMR] - ./src/components/index.ts process-update.js?e13e:116 [HMR] - ./src/navigators/app-navigator.tsx process-update.js?e13e:121 [HMR] App is up to date. But the page doesn’t update until I change navigation.

any thoughts?

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:8 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
zamotanycommented, Jan 14, 2018

@jrwpatterson

There’s a high chance that the HMR is not working for you, because your component might have not been registered by react-hot-loader.

Usually this is done in Babel config by using react-hot-loader/babel plugin. However since, you are using TS, this means that .ts/.tsx files will (probably) be processed only by awesome-typescript-loader.

So, here’s what you can do:

  • either add babel-loader to your /\.tsx?$/ rule in webpack.haul.js as shown below:
 module: {
    ...module,
    rules: [
      ...module.rules,
      {
        test: /\.tsx?$/,
        exclude: undefined,
        use: [{
          loader: 'babel-loader',
          options: {
            plugins: ['react-hot-loader/babel'],
            // babelrc: false, // you might need this
          }
        },
        {
          loader: 'awesome-typescript-loader',
          options: {
            transpileOnly: true,
            useTranspileModule: false,
            sourceMap: true,
            useBabel: true
          }
        }]
      }
    ]
  },
  • or add react-hot-loader/webpack to your /\.tsx?$/ rule in webpack.haul.js as shown below:
 module: {
    ...module,
    rules: [
      ...module.rules,
      {
        test: /\.tsx?$/,
        exclude: undefined,
        use: [{
          loader: 'react-hot-loader/webpack',
        },
        {
          loader: 'awesome-typescript-loader',
          options: {
            transpileOnly: true,
            useTranspileModule: false,
            sourceMap: true,
            useBabel: true
          }
        }]
      }
    ]
  },

EDIT: since in awesome-typescript-loader options useBabel is set to true you can try passing react-hot-loader/babel plugin to it somehow or adding it to .babelrc.

0reactions
zamotanycommented, Aug 12, 2019

Closing due to inactivity and the fact that in @haul-bundler/cli we dropped support for HMR.

Read more comments on GitHub >

github_iconTop Results From Across the Web

HMR not working on webpack 5.66.0 · Issue #15206 - GitHub
Hot module reloading is not working after updating webpack to v5.66.0. If the current behavior is a bug, please provide the steps to ......
Read more >
React + Webpack HMR is refreshing the page (not hot loading)
I just ran into this problem. A couple things: To help debug your particular issue, try enabling "Preserve log" (in Chrome dev tools)....
Read more >
Hot Module Replacement - webpack
Hot Module Replacement (HMR) exchanges, adds, or removes modules while an application is running, without a full reload. This can significantly speed up ......
Read more >
How To Fix Laravel Sail Hot Reloading (HMR) Not Working Error
Hot Module Replacement (HMR) or Hot Reloading is a technique used to refresh web pages as we make changes to the code of...
Read more >
HMR and Hot Reloading with the webpack-dev-server
"TypeError: Cannot read property 'prototype' of undefined" (if inline is true). Client Side rendering with HMR using react-refresh-webpack-plugin. Basic ...
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