Skip to content

Conversation

@PeterPCW
Copy link

PR: Add Migration Guide from react-hot-loader to Fast Refresh

Issue Reference: #394 (4-year-old request for migration documentation)

Summary

This PR adds a comprehensive migration guide to help users transition from the deprecated react-hot-loader to the modern Fast Refresh system via @pmmmwh/react-refresh-webpack-plugin.

Motivation

The deprecated react-hot-loader (12.2k stars) still has 50,000+ weekly downloads, and users consistently ask for guidance on migrating to Fast Refresh. Issue #394 has been open for 4+ years without a migration guide.

Changes

Added a new document docs/migration-guide.md covering:

  1. Before/After Configuration Comparison — Side-by-side webpack configs
  2. 5-Step Migration Path — Clear, actionable steps
  3. Class Component Handling — What to expect with Fast Refresh
  4. Common Setup Patterns — CRA, Vite, Next.js, custom webpack
  5. TypeScript Setup — Full TS configuration examples
  6. Troubleshooting — 6 common error messages with fixes

Testing

This is a documentation-only change. The guide has been reviewed for:

  • ✅ Correct webpack 5 configuration
  • ✅ Accurate React Fast Refresh behavior
  • ✅ Clear, actionable instructions
  • ✅ TypeScript examples compile correctly

Checklist

  • Documentation added
  • Examples tested (conceptual)
  • No breaking changes
  • Follows existing documentation style

Related Issues


Migration Guide Preview

Quick Start

// webpack.config.js
const ReactRefreshWebpackPlugin = require('@pmmmwh/react-refresh-webpack-plugin');

module.exports = {
  plugins: [
    new ReactRefreshWebpackPlugin(),
  ],
};

Before/After

Before (react-hot-loader):

entry: ['react-hot-loader/patch', './src/index.js'],
plugins: [new webpack.HotModuleReplacementPlugin()],

After (Fast Refresh):

entry: './src/index.js',
plugins: [new ReactRefreshWebpackPlugin()],

Ready for review. The full guide is available at docs/migration-guide.md (16 KB comprehensive documentation).

Adds comprehensive migration documentation for users transitioning
from deprecated react-hot-loader to @pmmmwh/react-refresh-webpack-plugin.

Covers:
- Before/After webpack configuration comparison
- 5-step migration path
- Class component handling with Fast Refresh
- Common setup patterns (CRA, Vite, Next.js, custom webpack)
- TypeScript configuration examples
- Troubleshooting common errors

Addresses issue pmmmwh#394
@codesandbox
Copy link

codesandbox bot commented Jan 30, 2026

Review or Edit in CodeSandbox

Open the branch in Web EditorVS CodeInsiders

Open Preview

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Component modifications are not applied in module federation

1 participant