superset icon indicating copy to clipboard operation
superset copied to clipboard

chore: remove deprecated react-hot-loader

Open rusackas opened this issue 2 weeks ago • 3 comments

User description

Summary

This PR removes the deprecated react-hot-loader package since React Refresh is already configured and working in the project via the SWC loader.

Changes:

  • Removed react-hot-loader dependency from package.json
  • Removed hot() wrapper from App.tsx
  • Removed setHotLoaderConfig from preamble.ts
  • Removed react-hot-loader/babel plugin from babel.config.js
  • Removed react-hot-loader from webpack vendor bundle
  • Cleaned up related comments

Before/After

Before: Project had both react-hot-loader (deprecated) and React Refresh configured After: Only React Refresh is used for hot module replacement

Testing Instructions

  1. Run npm run dev-server
  2. Make changes to React components
  3. Verify hot module replacement works correctly (components update without full page refresh)
  4. Verify no console errors related to hot module replacement

Tested locally: Dev server compiles successfully and HMR works as expected.

Additional Information

React Refresh has been the recommended HMR solution for React since React 17. The react-hot-loader package is deprecated and no longer maintained. This migration simplifies our development setup by removing unnecessary dependencies.

🤖 Generated with Claude Code


CodeAnt-AI Description

Remove deprecated react-hot-loader and add dependency-checker tool

What Changed

  • Removed react-hot-loader and all references (package.json, package-lock, babel plugin, webpack vendor list, and hot() wrapper); development hot module replacement continues to work via React Refresh.
  • Dev server no longer triggers deprecated react-hot-loader warnings and the dev vendor bundle no longer contains react-hot-loader, reducing the development bundle size.
  • Added a new CLI script (scripts/check-dependencies.py) and an agent doc (AGENTS/dependency-checker.md) that scan the frontend codebase for unused or transitive npm dependencies and produce human-readable and JSON reports with keep/remove/investigate recommendations.

Impact

✅ No deprecated HMR warnings in dev server ✅ Smaller dev vendor bundle during development ✅ Easier detection of unused frontend dependencies

💡 Usage Guide

Checking Your Pull Request

Every time you make a pull request, our system automatically looks through it. We check for security issues, mistakes in how you're setting up your infrastructure, and common code problems. We do this to make sure your changes are solid and won't cause any trouble later.

Talking to CodeAnt AI

Got a question or need a hand with something in your pull request? You can easily get in touch with CodeAnt AI right here. Just type the following in a comment on your pull request, and replace "Your question here" with whatever you want to ask:

@codeant-ai ask: Your question here

This lets you have a chat with CodeAnt AI about your pull request, making it easier to understand and improve your code.

Example

@codeant-ai ask: Can you suggest a safer alternative to storing this secret?

Preserve Org Learnings with CodeAnt

You can record team preferences so CodeAnt AI applies them in future reviews. Reply directly to the specific CodeAnt AI suggestion (in the same thread) and replace "Your feedback here" with your input:

@codeant-ai: Your feedback here

This helps CodeAnt AI learn and adapt to your team's coding style and standards.

Example

@codeant-ai: Do not flag unused imports.

Retrigger review

Ask CodeAnt AI to review the PR again, by typing:

@codeant-ai: review

Check Your Repository Health

To analyze the health of your code repository, visit our dashboard at https://app.codeant.ai. This tool helps you identify potential issues and areas for improvement in your codebase, ensuring your repository maintains high standards of code health.

rusackas avatar Dec 04 '25 21:12 rusackas

CodeAnt AI is reviewing your PR.

Nitpicks 🔍

🔒 No security issues identified
⚡ Recommended areas for review

  • [ ] Questionable Logic
    When dependents are found in package-lock, analyze_dependency sets status 'transitive-only' and recommendation 'remove'. This is counterintuitive: if other packages depend on this package, removing it may break those dependents or conversely it may be safe to remove if it's provided transitively. This behavior should be documented or re-checked to ensure the recommendation is correct.

  • [ ] Missing file handling
    Opening package.json and package-lock.json is done without checking existence or handling JSON decoding errors. If the provided --path is incorrect or files are missing/corrupt the script will raise an unhandled exception. Consider early checks and clearer error messages or safe fallbacks.

  • [ ] Fragile config file reading
    The code opens all matching config files without try/except; unreadable files or directories (or binary/large files) could raise exceptions. Also glob patterns may match unexpected files. Consider guarding file reads and skipping non-regular files.

  • [ ] Build / config residue
    Ensure all build-tooling and config (SWC/Babel/webpack) have been updated consistently to use React Refresh instead of react-hot-loader. Confirm there are no remaining references or plugins that assume react-hot-loader (imports, babel plugins, vendor bundles, or webpack aliases).

  • [ ] Removed import audit
    The import for react-hot-loader was removed. Make sure there are no remaining references elsewhere in the codebase or build config (Babel, webpack, vendor lists). A quick search and CI build check should confirm there are no missing symbols.

  • [ ] HMR behavior change
    Removing the react-hot-loader wrapper and exporting the raw App relies on React Refresh behavior. Verify that HMR preserves component state and update behavior across the app (particularly for any class components and legacy code paths that relied on react-hot-loader's advanced state-preservation behavior).

  • [ ] Performance Issue
    The search_for_imports routine invokes ripgrep/grep once per pattern per source path per package. For large dependency lists this results in many separate subprocess calls and repeated scanning of the same directories, which is slow. Consider batching patterns into a single rg invocation or searching once per package and post-filtering results.

  • [ ] Empty dev block
    The development-only conditional no longer executes any code and only contains a comment. This is a code smell (and can trigger linter warnings). Either remove the conditional entirely or make it do a minimal runtime check (e.g. verify HMR is available) so the intent is explicit.

CodeAnt AI finished reviewing your PR.

CodeAnt AI is running Incremental review