
Company News
Socket Named Top Sales Organization by RepVue
Socket won two 2026 Reppy Awards from RepVue, ranking in the top 5% of all sales orgs. AE Alexandra Lister shares what it's like to grow a sales career here.
@webhotelier/webpack-fast-refresh
Advanced tools
React Fast Refresh plugin and loader for webpack v5+
React Fast Refresh for webpack@5+ and babel@7.9+
This repository is to be considered EXPERIMENTAL. For most use cases we recommend using the officially endorsed webpack plugin available at pmmmwh/react-refresh-webpack-plugin.
react-refresh and webpack-fast-refreshnpm install -D -E @webhotelier/webpack-fast-refresh react-refresh
# or
yarn add -D -E @webhotelier/webpack-fast-refresh react-refresh
Make the following changes to your webpack.config.js:
const ReactRefreshPlugin = require('@webhotelier/webpack-fast-refresh');
config.plugins.unshift(new ReactRefreshPlugin());
// or if you have an object-based config:
{
...otherSettings,
plugins: [new ReactRefreshPlugin(), ...otherplugins];
}
Depending on how you have configured your entry, change it similarly to the following examples:
- config.entry = './index.js'; // or
- config.entry = ['./index.js'];
+ config.entry = ['@webhotelier/webpack-fast-refresh/runtime.js', './index.js'];
- config.entry = {
- import: './index.js', // or
- import: ['./index.js'],
- };
+ config.entry = {
+ import: ['@webhotelier/webpack-fast-refresh/runtime.js', './index.js'],
+ };
- config.main.entry = './index.js'; // or
- config.main.entry = ['./index.js'];
+ config.main.entry = [
+ '@webhotelier/webpack-fast-refresh/runtime.js',
+ './index.js',
+ ];
{
"entry": {
- "main": "./index.js" // or
- "main": ["./index.js"]
+ "main": ["@webhotelier/webpack-fast-refresh/runtime.js", "./index.js"]
}
}
{
"module": {
"rules": [
{
"test": /\.jsx$/,
"use": [
{ "loader": "babel-loader", "options": { "cacheDirectory": true } },
+ { "loader": "@webhotelier/webpack-fast-refresh/loader.js" }
]
}
]
}
}
or push it with code:
// make sure to use the index of your JSX loader, 0 in this example
config.module.rules[0].use.push('@webhotelier/webpack-fast-refresh/loader.js');
Add react-refresh/babel to your babelrc:
{
"presets": [["@babel/preset-react", { "runtime": "automatic" }]],
+ "plugins": ["react-refresh/babel"]
}
const ErrorOverlayPlugin = require('@webhotelier/webpack-fast-refresh/error-overlay');
config.plugins.push(new ErrorOverlayPlugin());
// or if you have an object-based config:
{
...otherSettings,
plugins: [new ErrorOverlayPlugin(), ...otherplugins];
}
Make sure you have HMR enabled.
webpack-dev-server --hot --mode development
In webpack.config.js:
config.entry.main.unshift(require.resolve('webpack-hot-middleware/client'));
config.plugins.push(new webpack.HotModuleReplacementPlugin());
In your node server:
if (app.get('env') === 'development') {
const webpack = require('webpack');
const webpackConfig = require('./webpack.config.json');
const webpackCompiler = webpack(webpackConfig);
app.use(
require('webpack-dev-middleware')(webpackCompiler, {
lazy: false,
publicPath: webpackConfig.output.publicPath,
headers: { 'Access-Control-Allow-Origin': '*' },
})
);
app.use(
require('webpack-hot-middleware')(webpackCompiler, {
path: '/__webpack_hmr',
heartbeat: 10 * 1000,
noInfo: false,
quiet: false,
})
);
}
This plugin is not compatible with html-webpack-plugin at the moment.
The above plugin & loader DO NOT check if they are running in production builds and do not automatically disable themselves. Make sure you add the correct checks to only include them in development builds.
FAQs
React Fast Refresh plugin and loader for webpack v5+
The npm package @webhotelier/webpack-fast-refresh receives a total of 839 weekly downloads. As such, @webhotelier/webpack-fast-refresh popularity was classified as not popular.
We found that @webhotelier/webpack-fast-refresh demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Company News
Socket won two 2026 Reppy Awards from RepVue, ranking in the top 5% of all sales orgs. AE Alexandra Lister shares what it's like to grow a sales career here.

Security News
NIST will stop enriching most CVEs under a new risk-based model, narrowing the NVD's scope as vulnerability submissions continue to surge.

Company News
/Security News
Socket is an initial recipient of OpenAI's Cybersecurity Grant Program, which commits $10M in API credits to defenders securing open source software.