Skip to content

🔧 Fix React Scripts devServer.close compatibility with Node.js v20+#30

Open
Aswinmcw wants to merge 1 commit into
mainfrom
fix/react-scripts-devserver-node-compatibility
Open

🔧 Fix React Scripts devServer.close compatibility with Node.js v20+#30
Aswinmcw wants to merge 1 commit into
mainfrom
fix/react-scripts-devserver-node-compatibility

Conversation

@Aswinmcw

@Aswinmcw Aswinmcw commented Jul 1, 2025

Copy link
Copy Markdown
Member

🐛 Problem\n\nWhen using Node.js v20+ (including v24) with React Scripts 5.0.1, the development server crashes on shutdown with:\n\n\nTypeError: devServer.close is not a function\n at process.<anonymous> (/path/to/react-scripts/scripts/start.js:144:19)\n\n\nThis happens because webpack-dev-server v4+ changed the shutdown API, but React Scripts wasn't updated to handle both the old and new methods.\n\n## ✅ Solution\n\nThis PR implements a robust compatibility fix using patch-package:\n\n### 🔧 Changes Made\n\n1. Added patch-package dependency for persistent fixes\n2. Created comprehensive shutdown handler that supports:\n - devServer.close(callback) (webpack-dev-server v3)\n - devServer.stop() (webpack-dev-server v4+)\n - Graceful fallback to process.exit()\n3. Added proper error handling with callbacks and promises\n4. Automated patch application via postinstall script\n\n### 📁 Files Changed\n\n- client/package.json - Added patch-package dependency + postinstall script\n- client/patches/react-scripts+5.0.1.patch - Permanent fix for devServer shutdown\n\n### 🧪 Testing\n\n✅ Before: Pressing Ctrl+C crashed with TypeError \n✅ After: Clean shutdown with proper cleanup \n✅ Compatibility: Works with Node.js v18, v20, v22, v24+ \n✅ Persistence: Survives npm installs via patch-package \n\n## 🎯 Impact\n\n- Fixes development workflow interruption\n- Maintains compatibility with all modern Node.js versions\n- Zero breaking changes - transparent fix\n- Persistent solution - won't regress on dependency updates\n\n## �� Related Issues\n\nThis addresses the Node.js v20+ compatibility discussion and ensures smooth development experience for all team members using modern Node.js versions.\n\n---\n\n**Ready for review and testingpush -u origin fix/react-scripts-devserver-node-compatibility* 🚀

@Aswinmcw
Aswinmcw requested a review from Aswin-coder as a code owner July 1, 2025 13:59
@Aswinmcw
Aswinmcw force-pushed the fix/react-scripts-devserver-node-compatibility branch from a742050 to a97272f Compare July 1, 2025 14:01
@Aswinmcw
Aswinmcw enabled auto-merge (squash) July 1, 2025 16:16
@github-actions

github-actions Bot commented Jul 1, 2025

Copy link
Copy Markdown

🚀 Preview Deployment Ready!

Your PR has been successfully deployed and is ready for testing:

🌐 Preview Link

Frontend: https://pr-approval-finder-iuxr4jdxg-aswincoders-projects.vercel.app

📊 Deployment Details

🧪 Test Your Changes

You can now test the PR approval finder with your changes:

  1. Visit the preview URL above
  2. Enter a GitHub PR URL to test functionality
  3. Verify all features work as expected

📝 Notes

  • This preview will be automatically updated when you push new commits
  • The deployment will be cleaned up when the PR is closed
  • Note: This is a static frontend deployment. For full-stack testing with the API, use a self-hosted runner.

Deployed by GitHub Actions • View Workflow

@Aswin-coder
Aswin-coder force-pushed the fix/react-scripts-devserver-node-compatibility branch from a97272f to f6f1837 Compare July 2, 2025 05:01
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.

1 participant