Migrate from CRA to Vite and upgrade to React 19#21
Open
devin-ai-integration[bot] wants to merge 1 commit into
Open
Migrate from CRA to Vite and upgrade to React 19#21devin-ai-integration[bot] wants to merge 1 commit into
devin-ai-integration[bot] wants to merge 1 commit into
Conversation
- Replace react-scripts with vite, @vitejs/plugin-react - Move public/index.html to root, add module script entry - Rename src/index.js to src/index.jsx, migrate to createRoot API - Create vite.config.js with path aliases matching jsconfig.json - Remove reportWebVitals.js and web-vitals dependency - Remove browserslist and eslintConfig from package.json - Replace Jest with Vitest (vitest, @vitest/ui, jsdom) - Upgrade React and React DOM to ^19.0.0 - Fix react-transition-group findDOMNode usage with nodeRef in Alert and Modal - Upgrade testing libraries (@testing-library/react ^16, jest-dom ^6, user-event ^14) - Upgrade react-icons to ^5.x, classnames to ^2.5, sass to ^1.86, react-countdown to ^2.3.6 - Fix App.test.jsx placeholder test to match actual app content - Rename AlertContext.js to AlertContext.jsx for Vite JSX parsing Co-Authored-By: shahmir.masood <shahmir.masood@cognition.ai>
Author
🤖 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:
|
Author
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Complete migration from Create React App (CRA) to Vite and upgrade from React 17 to React 19. This modernizes the build tooling and ensures compatibility with React's latest APIs.
Changes
Build tooling (CRA → Vite):
react-scriptswithvite+@vitejs/plugin-reactvite.config.jswith path aliases matching the existingjsconfig.jsonbaseUrl: "src"setuppublic/index.html→ rootindex.htmlwith Vite module script entry%PUBLIC_URL%references with plain paths (Vite handles public assets differently)browserslistandeslintConfigsections frompackage.jsonreportWebVitals.jsand removedweb-vitalsdependencyReact 17 → 19:
reactandreact-domto^19.0.0src/index.js→src/index.jsxusingcreateRootAPI instead ofReactDOM.rendernodeReftoCSSTransitioninAlert.jsxandModal.jsx(replaces removedfindDOMNode)AlertContext.js→AlertContext.jsxfor Vite's JSX parsing requirementTesting (Jest → Vitest):
react-scripts test(Jest) with Vitest (vitest,jsdom)vite.config.jswithglobals: trueandjsdomenvironment@testing-library/reactto^16.0.0,@testing-library/jest-domto^6.0.0,@testing-library/user-eventto^14.0.0App.test.jsx— replaced CRA placeholder test ("learn react") with a test that matches actual app contentDependency upgrades:
react-icons:^4.3.1→^5.4.0classnames:^2.3.1→^2.5.1sass:^1.49.9→^1.86.0react-countdown:^2.3.2→^2.3.6react-transition-group:^4.4.2→^4.4.5Screenshot of running app (Vite dev server):

Review & Testing Checklist for Human
npm startand verify the app loads, play a game, check dark mode / high contrast / hard mode toggles, modals open/close, alerts animatenpm run buildand verify production build succeedsnpm run testand verify tests passNotes
npm run buildproduces adist/folder (Vite default) instead of CRA'sbuild/folderejectscript has been removed since it was CRA-specificvite.config.jsLink to Devin session: https://app.devin.ai/sessions/b94e4bb693f84028b4d7eb1dc19b30f3
Requested by: @shahmir-masood
Devin Review