Registry /
web-framework / babel-preset-react-hmre
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
}
}
Errors
Common errors & fixes
Error: Module 'babel-preset-react-hmre' is not found
Missing dependency or using with Babel 7+ which changed preset resolution.
fixInstall 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.
fixEnsure 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.
fixWrap functional components with React.memo or convert to class component. Or upgrade to React Fast Refresh.
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.