React Transform HMR

1.0.4 · abandoned · verified Sun Apr 19

react-transform-hmr is a Babel transform designed to enable hot module reloading (HMR) for React components, primarily leveraging Webpack's Hot Module Replacement API. Currently at version 1.0.4, its development has seen minor updates, mainly around `react-proxy` bumps. It is explicitly presented as "highly experimental tech" and "not long term," intended more for prototyping future React developer experiences than for stable project use. The package's explicit goal is to be superseded by less hacky, built-in React features. It requires `babel-plugin-react-transform` as a prerequisite and operates by modifying React class components at compile-time to support HMR. A significant limitation is its inability to work with stateless functional components introduced in React 0.14 and later. Users are strongly cautioned against relying on it for production or long-term projects, as the underlying technologies could drastically change or be deprecated. Its release cadence was active in late 2015, but has since ceased, indicating an abandoned status in favor of more stable HMR solutions like React Refresh.

Common errors

Warnings

Install

Imports

Quickstart

This configuration snippet for `.babelrc` shows how to enable `react-transform-hmr` specifically for the development environment, ensuring it's not bundled in production builds. It sets up the `react-transform` plugin with `react-transform-hmr` as one of its transforms, specifying `react` as an import and `module` as a local for HMR.

{  "presets": ["es2015", "stage-0"],
  "env": {
    "development": {
      "plugins": [["babel-plugin-react-transform", {
        "transforms": [{
          "transform": "react-transform-hmr",
          "imports": ["react"],
          "locals": ["module"]
        }]
      }]]
    }
  }
}

view raw JSON →