Migrate from CRA to Vite + React 19 (integrated from 4 parallel sessions)#13
Migrate from CRA to Vite + React 19 (integrated from 4 parallel sessions)#13devin-ai-integration[bot] wants to merge 10 commits into
Conversation
- Upgrade react-transition-group to ^4.4.5 - Add nodeRef to CSSTransition in Alert.jsx - Add transitionRef to CSSTransition in Modal.jsx Co-Authored-By: shahmir.masood <shahmir.masood@cognition.ai>
- 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>
- Upgrade react-icons to ^5.6.0 - Upgrade react-countdown to ^2.3.6 - Upgrade sass to ^1.99.0 - Upgrade classnames to ^2.5.1 - Install eslint, @eslint/js, eslint-plugin-react, eslint-plugin-react-hooks - Create eslint.config.js with flat config format - Remove eslintConfig from package.json - Add lint script to package.json - Fix unused variable in src/lib/words.js Co-Authored-By: shahmir.masood <shahmir.masood@cognition.ai>
- Remove old testing libraries (@testing-library/react ^12, jest-dom ^5, user-event ^13) - Install vitest, jsdom, @testing-library/react ^16, jest-dom ^6, user-event ^14, @vitejs/plugin-react - Create vitest.config.js with path aliases, jsdom environment, and JSX-in-JS support - Add react-dom/client compatibility shim for React 17 - Update setupTests.js (remove CRA comments) - Update package.json test script to use vitest - Fix App.test.jsx to render with AlertProvider context Co-Authored-By: shahmir.masood <shahmir.masood@cognition.ai>
…nsition-group ^4.4.5, drop react-scripts Co-Authored-By: shahmir.masood <shahmir.masood@cognition.ai>
…est script, move testing libs to devDependencies Co-Authored-By: shahmir.masood <shahmir.masood@cognition.ai>
…w on React 19) Co-Authored-By: shahmir.masood <shahmir.masood@cognition.ai>
…, classnames latest), added ESLint flat config Co-Authored-By: shahmir.masood <shahmir.masood@cognition.ai>
…cate @vitejs/plugin-react, rename AlertContext.js to .jsx for Rolldown 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.5.1", | ||
| "react": "^19.2.5", | ||
| "react-countdown": "^2.3.6", | ||
| "react-dom": "^19.2.5", | ||
| "react-icons": "^5.6.0", | ||
| "react-transition-group": "^4.4.5", | ||
| "sass": "^1.99.0", | ||
| "vite": "^8.0.10" |
There was a problem hiding this comment.
🟡 Build-time dependencies vite and @vitejs/plugin-react incorrectly placed in dependencies instead of devDependencies
vite and @vitejs/plugin-react are build-time tools that should be in devDependencies, not dependencies. The PR already correctly places vitest in devDependencies, making this inconsistent. When deploying with npm install --omit=dev (standard for production), these large packages (~80MB+) will still be installed unnecessarily, increasing install time, image size, and attack surface in production environments.
Prompt for agents
Move `vite` and `@vitejs/plugin-react` from `dependencies` to `devDependencies` in package.json. These are build-time tools (bundler and its plugin) that are not needed at runtime. The `sass` package should likely also be moved to devDependencies for the same reason, as it is only used during the build step to compile SCSS files. After making the change in package.json, run `npm install` to update package-lock.json.
Was this helpful? React with 👍 or 👎 to provide feedback.
There was a problem hiding this comment.
Fixed — moved vite, @vitejs/plugin-react, and sass to devDependencies in 44186ee. Build and tests still pass.
Co-Authored-By: shahmir.masood <shahmir.masood@cognition.ai>
Summary
Complete migration from Create React App (React 17) to Vite 8 + React 19, executed via 4 parallel Devin child sessions and integrated sequentially.
What changed
Session A — Core Migration (PR #10):
react-scriptsandweb-vitalsvite@^8and@vitejs/plugin-react@^6react/react-domto^19vite.config.jswith path aliases for absolute importsindex.htmlto root, removed%PUBLIC_URL%referencessrc/index.js→src/main.jsx, migrated tocreateRootAPIstart→vite,build→vite build,preview→vite previewSession B — react-transition-group nodeRef (PR #9):
react-transition-groupto^4.4.5nodeReftoCSSTransitioninAlert.jsxandModal.jsx(required for React 19 —findDOMNoderemoved)Session C — Testing Infrastructure (PR #12):
@testing-libraryv12/v5/v13 packagesvitest@^4,@testing-library/react@^16,@testing-library/jest-dom@^6,@testing-library/user-event@^14vite.config.js(removed standalonevitest.config.js)App.test.jsxto test actual app rendering withAlertProviderSession D — ESLint + Dependency Upgrades (PR #11):
react-iconsto^5.6.0,sassto^1.99.0,classnamesto^2.5.1,react-countdownto^2.3.6eslint.config.js) witheslint-plugin-reactandeslint-plugin-react-hooksIntegration fixes:
package.jsonacross all 4 branchesreact-dom/clientshim (no longer needed with React 19)vitestfrom v2 to v4 for Vite 8 compatibility@vitejs/plugin-reactfrom devDependenciesAlertContext.js→AlertContext.jsxfor Vite 8/Rolldown JSX parsingVerification
npm install— clean install, 0 vulnerabilitiesnpm run build— production build succeeds (85 modules, 340KB JS gzipped to 125KB)npm test(vitest) — 1 test file, 1 test passingnpm run lint— no errorsnpm run start— dev server running, app loads and renders correctlyReview & Testing Checklist for Human
npm run startand play a full game — type guesses, submit with ENTER, verify color-coded feedback (green/yellow/gray)Notes
eslint.config.jsuses ESMimportsyntax; Node emits a harmless warning about missing"type": "module"in package.json. Adding it would require converting all.jsconfig files to ESM which is out of scope.Link to Devin session: https://app.devin.ai/sessions/087adf1870154c4ca25a846c20e91b4d
Requested by: @shahmir-masood
Devin Review