Skip to content

refactor: migrate from CRA to Vite by updating environment variables …#960

Merged
umeshmore45 merged 2 commits intodevfrom
chore/cra-to-vite-migration
Feb 17, 2026
Merged

refactor: migrate from CRA to Vite by updating environment variables …#960
umeshmore45 merged 2 commits intodevfrom
chore/cra-to-vite-migration

Conversation

@shobhitupadhyayy
Copy link
Contributor

…and configuration files, enhancing build process and performance. Remove deprecated files and adjust API references to align with new structure.

…and configuration files, enhancing build process and performance. Remove deprecated files and adjust API references to align with new structure.

Co-authored-by: Cursor <cursoragent@cursor.com>
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Refactors the UI build toolchain by migrating from Create React App (CRA) to Vite, updating environment variable access patterns and build/runtime configuration to align with Vite’s conventions.

Changes:

  • Replaced CRA process.env.REACT_APP_* usage with Vite import.meta.env.VITE_* and added Vite config/TS setup.
  • Updated UI build + containerization (Vite build output, vite preview, HTML entrypoint changes).
  • Adjusted supporting scripts/config (docker-compose env vars, env generation script, upload-api build script).

Reviewed changes

Copilot reviewed 16 out of 20 changed files in this pull request and generated 8 comments.

Show a summary per file
File Description
upload-api/src/config/index.ts Updates backend defaults/config values (currently replaced with placeholders).
upload-api/package.json Makes build script skip non-package migration folders.
upload-api/migration-aem/package-lock.json Lockfile updates (adds node/undici types).
api/package-lock.json Lockfile metadata changes (devdevOptional, removals).
ui/vite.config.ts Adds Vite configuration (React SWC + tsconfig paths + logging tweaks).
ui/tsconfig.json Adjusts TS target/module and adds Vite client types.
ui/src/vite-env.d.ts Adds Vite client type reference.
ui/src/utilities/constants.ts Migrates env var reads to import.meta.env.
ui/src/reportWebVitals.js Removes CRA web-vitals helper.
ui/src/index.tsx Removes web-vitals wiring from app bootstrap.
ui/src/components/TestMigration/index.tsx Updates API base URL source to Vite env.
ui/src/components/MigrationExecution/index.tsx Updates API base URL source to Vite env.
ui/src/components/ContentMapper/index.tsx Replaces NodeJS timeout type with browser-safe ReturnType<typeof setTimeout>.
ui/package.json Replaces CRA scripts/deps with Vite tooling and updates ESLint config.
ui/index.html Converts CRA placeholders to Vite-style HTML + adds module entry script.
ui/Dockerfile Builds UI during image build and serves via vite preview.
ui/.env.local Renames env vars to VITE_*.
index.js Updates generated UI env file content to VITE_*.
docker-compose.yml Renames UI env vars to VITE_*.
Files not reviewed (2)
  • api/package-lock.json: Language not supported
  • upload-api/migration-aem/package-lock.json: Language not supported

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

…s; adjust .gitignore and package.json to include new dependencies and ensure proper environment variable handling
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 17 out of 21 changed files in this pull request and generated 2 comments.

Files not reviewed (2)
  • api/package-lock.json: Language not supported
  • upload-api/migration-aem/package-lock.json: Language not supported

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +1 to +6
VITE_WEBSITE_BASE_URL="http://localhost:3000/"
VITE_BASE_API_URL="http://localhost:5001/"
VITE_API_VERSION=v2
VITE_HOST="http://localhost:3000"
VITE_UPLOAD_SERVER="http://localhost:4002/"
VITE_OFFLINE_CMS=true
Copy link

Copilot AI Feb 17, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ui/.env.local is committed with localhost defaults, but Vite loads .env.local even in production builds. This risks baking machine-specific URLs into the bundle and can also conflict with docker-provided env at build time. Remove this file from version control (keep it developer-local), and instead commit a .env.example (or .env) with safe placeholder values.

Suggested change
VITE_WEBSITE_BASE_URL="http://localhost:3000/"
VITE_BASE_API_URL="http://localhost:5001/"
VITE_API_VERSION=v2
VITE_HOST="http://localhost:3000"
VITE_UPLOAD_SERVER="http://localhost:4002/"
VITE_OFFLINE_CMS=true
VITE_WEBSITE_BASE_URL="https://frontend.example.com/"
VITE_BASE_API_URL="https://api.example.com/"
VITE_API_VERSION=v2
VITE_HOST="https://frontend.example.com"
VITE_UPLOAD_SERVER="https://upload.example.com/"
VITE_OFFLINE_CMS=false

Copilot uses AI. Check for mistakes.
Comment on lines +23 to +24
"typeRoots": ["./node_modules/@types", "./src/types"],
"types": ["vite/client"]
Copy link

Copilot AI Feb 17, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

vite/client typings are being included twice (via types: ["vite/client"] here and via src/vite-env.d.ts). Pick one mechanism to avoid redundant/global type pollution; the common Vite approach is to keep only src/vite-env.d.ts and remove the explicit types entry (or vice versa).

Suggested change
"typeRoots": ["./node_modules/@types", "./src/types"],
"types": ["vite/client"]
"typeRoots": ["./node_modules/@types", "./src/types"]

Copilot uses AI. Check for mistakes.
@umeshmore45 umeshmore45 merged commit ff7494e into dev Feb 17, 2026
13 checks passed
@umeshmore45 umeshmore45 deleted the chore/cra-to-vite-migration branch February 17, 2026 11:43
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.

2 participants