feat: migrate from CRA to Vite + React 19#10
Conversation
- Remove react-scripts and web-vitals dependencies - Install vite and @vitejs/plugin-react - Upgrade react and react-dom to ^19.0.0 - Create vite.config.js with path aliases for absolute imports - Move public/index.html to project root, remove %PUBLIC_URL% refs and CRA comments - Add module script tag for Vite entry point - Rename src/index.js to src/main.jsx with createRoot API - Remove src/reportWebVitals.js - Update package.json scripts (start, build, preview) - Remove eslintConfig and browserslist sections from package.json Co-Authored-By: shahmir.masood <shahmir.masood@cognition.ai>
🤖 Devin AI EngineerI'll be helping with this pull request! Here's what you should know: ✅ I will automatically:
Note: I can only respond to comments from users who have write access to this repository. ⚙️ Control Options:
|
| "@vitejs/plugin-react": "^6.0.1", | ||
| "classnames": "^2.3.1", | ||
| "react": "^17.0.2", | ||
| "react": "^19.2.5", |
There was a problem hiding this comment.
🔴 react-transition-group v4.4.2 uses removed findDOMNode API from React 19
The PR upgrades React from 17 to 19, but keeps react-transition-group at v4.4.2. This version internally calls ReactDOM.findDOMNode() when no nodeRef prop is provided, and findDOMNode was removed in React 19. The CSSTransition components in src/components/Modal/Modal.jsx:13 and src/components/Alert/Alert.jsx:17-22 do not pass a nodeRef prop, which means they rely on the findDOMNode code path. This will cause a runtime crash when modals or alerts are shown/hidden.
Affected CSSTransition usages without nodeRef
In Modal.jsx:
<CSSTransition in={isOpen} timeout={300} classNames={'fade'} unmountOnExit>In Alert.jsx:
<CSSTransition in={isVisible} timeout={300} classNames={'fadeIn'} unmountOnExit>Both need a nodeRef prop to avoid the findDOMNode call, or react-transition-group needs to be upgraded to a version compatible with React 19.
Prompt for agents
The PR upgrades React to 19, but react-transition-group v4.4.2 uses ReactDOM.findDOMNode which was removed in React 19. There are two approaches to fix this:
1. Upgrade react-transition-group to a version that supports React 19 (if available), OR
2. Add nodeRef props to all CSSTransition usages to avoid the findDOMNode code path.
For approach 2, you need to:
- In src/components/Modal/Modal.jsx: Create a ref with useRef() and pass it as nodeRef to CSSTransition, and attach the ref to the wrapping div inside.
- In src/components/Alert/Alert.jsx: Similarly create a ref and pass nodeRef to CSSTransition, attaching the ref to the span element inside.
The nodeRef prop tells react-transition-group to use the provided ref instead of calling findDOMNode internally.
Was this helpful? React with 👍 or 👎 to provide feedback.
There was a problem hiding this comment.
Good catch — this is a known compatibility concern with the React 19 upgrade. However, modifying Modal.jsx and Alert.jsx is explicitly out of scope for this PR (Session A). Those component files are being handled by other parallel sessions in this 4-session migration. The nodeRef additions to CSSTransition usages will be addressed there.
Summary
Session A of a 4-session parallel migration. Migrates the foundational build toolchain from Create React App (react-scripts) to Vite, and upgrades React from v17 to v19.
Changes
react-scripts,web-vitals,src/reportWebVitals.jsvite,@vitejs/plugin-reactreactandreact-domto^19.0.0vite.config.jswith path aliases replicating CRA'ssrcbaseUrl behavior for absolute imports (components/,constants/,context/,hooks/,lib/,styles/)public/index.html→ project rootindex.html, removed%PUBLIC_URL%references and CRA-specific HTML comments, added Vite module script entry pointsrc/index.js→src/main.jsx, migrated fromReactDOM.rendertocreateRootAPIpackage.jsonscripts:start→vite,build→vite build, addedpreview→vite preview; removedeslintConfigandbrowserslistsectionsScope
Only touches build config and the entry point. No component files were modified — Alert.jsx, Modal.jsx, test files, etc. are handled by other parallel sessions.
Review & Testing Checklist for Human
npm run startand verify the app loads athttp://localhost:5173with the game board visiblenpm run buildand verify it produces adist/folder without errorsimport X from 'components/...') resolve correctly at runtimeNotes
localhost:5173testandejectscripts were removed since they relied onreact-scripts; testing infrastructure can be re-added in a follow-up sessionfix,check, andpreparescripts are preserved as-isLink to Devin session: https://app.devin.ai/sessions/a3a42c9610ce4c8faa175d386f2b08f8
Requested by: @shahmir-masood
Devin Review