Registry / web-framework / babel-preset-react-hmre

babel-preset-react-hmre

JSON →
library1.1.1jsnpmunverified

Babel preset for React Hot Module Replacement (HMR) and error catching using react-transform-hmr and react-transform-catch-errors. Version 1.1.1 is the latest stable release; originally designed for Babel 6 and is now deprecated due to lack of maintenance and incompatibility with Babel 7+ and modern React. Use this only for older projects, as alternatives like @pmmmwh/react-refresh-webpack-plugin provide better HMR support.

npm install babel-preset-react-hmre
INSTALL
IMPORT
SIG · BABEL-PRESET-REACT
B
babel-preset-react-hmre
web-frameworkjavascriptv1.1.1
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

default
Preset is used in .babelrc or Babel config: 'presets': ['react-hmre']
Explicitly installing and requiring 'react-transform-hmr' directly.
This is a Babel preset, not a direct import. Add it to the development environment in .babelrc.
React
No import needed; React is expected to be present.
Importing from 'react-hmre' or similar.
This preset modifies React components at build time, not runtime.
catchErrors
Not imported directly; configured via 'react-transform-catch-errors' as a Babel plugin.
Trying to import 'catchErrors' from the package.
The package provides a Babel preset, not a JavaScript module.

Configures Babel with the react-hmre preset for development hot reloading.

// .babelrc { "presets": ["react", "es2015"], "env": { "development": { "presets": ["react-hmre"] } } } // Install dependencies npm install --save-dev babel-preset-react-hmre babel-preset-react babel-preset-es2015 webpack webpack-dev-server webpack.config.js: module.exports = { entry: './src/index.js', output: { path: '/dist', filename: 'bundle.js' }, module: { rules: [ { test: /\.jsx?$/, exclude: /node_modules/, use: { loader: 'babel-loader', options: { presets: ['react-hmre'] } } } ] }, devServer: { hot: true } }
Debug
Known issues
deprecatedPackage is unmaintained and incompatible with Babel 7+ and React 16+. Use @hot-loader/react-dom or react-refresh.
fix
Migrate to @pmmmwh/react-refresh-webpack-plugin and @hot-loader/react-dom for modern React HMR.
affects: >=1.1.1
gotchaThis preset must only be used in development; enabling it in production will cause errors.
fix
Use Babel's env configuration to restrict the preset to development.
affects: >=1.0.0
gotchaRequires Babel 6 and React < 16.8. Does not work with Babel 7 or React hooks.
fix
Upgrade to a modern HMR solution like React Fast Refresh.
affects: >=1.0.0
breakingDepends on react-transform-hmr which is no longer maintained and has security advisories.
fix
Use react-refresh instead.
affects: >=1.0.0
Errors
Common errors & fixes
Error: Module 'babel-preset-react-hmre' is not found
Missing dependency or using with Babel 7+ which changed preset resolution.
fix
Install the package: npm install --save-dev babel-preset-react-hmre. Ensure Babel 6 is used, or switch to a modern alternative.
Uncaught Error: addComponentAsRefTo(...): Only a ReactOwner can have refs. You might be adding a ref to a component that was not created inside a component's render method, or you have multiple copies of React loaded
Conflicting React versions due to HMR implementation.
fix
Ensure only one copy of React is loaded; use webpack's resolve.alias to deduplicate.
TypeError: Cannot read property 'displayName' of undefined at ReactComponent.proxy
Incompatible with stateless functional components or component class syntax in older React.
fix
Wrap functional components with React.memo or convert to class component. Or upgrade to React Fast Refresh.
Upgrade
Version history
1.1.1latest on npm
Audit
Dependencies
babel-corerequiredRequires Babel 6.x to function; not compatible with Babel 7+.
react-transform-hmrrequiredCore dependency for React Hot Module Replacement.
react-transform-catch-errorsoptionalProvides error catching in development builds.
Agent activity
10 hits · last 30 days
node
8
OpenAI (training)
1
Resources
babel-preset-react-hmre — npm install babel-preset-react-hmre · libregistry