Skip to content

feat(FR-2606): Vite PoC phase 1 — dev server + HMR + React Compiler parity#6869

Merged
graphite-app[bot] merged 1 commit intomainfrom
04-20-feat_fr-2606_vite_poc_phase_1_dev_server_hmr_react_compiler_parity
Apr 30, 2026
Merged

feat(FR-2606): Vite PoC phase 1 — dev server + HMR + React Compiler parity#6869
graphite-app[bot] merged 1 commit intomainfrom
04-20-feat_fr-2606_vite_poc_phase_1_dev_server_hmr_react_compiler_parity

Conversation

@nowgnuesLee
Copy link
Copy Markdown
Contributor

@nowgnuesLee nowgnuesLee commented Apr 22, 2026

Resolves #6809(FR-2606)

Summary

First commit of the Vite migration stack. Stands up a working Vite dev server that mirrors the CRA/Craco dev behaviour so downstream commits can iterate safely.

  • react/vite.config.ts: @vitejs/plugin-react with babel-plugin-react-compiler (annotation mode), babel-plugin-relay, and vite-plugin-svgr. React Compiler parity with the existing CRA babel config.
  • projectRootStaticPlugin: serves /resources/, /manifest/, /dist/, /config.toml, etc. from the project root and reads the real project-root index.html as the SPA template (replaces craco devServer.static + HtmlWebpackPlugin).
  • transformIndexHtml hook injects /src/index.tsx, strips {{nonce}} in dev, and shims process.env.NODE_ENV = 'development' so dev-only branches still work.
  • Module aliases for src/, backend.ai-ui workspace source, backend.ai-client-esm (from dist/lib), and ESM shims for CJS leaf deps (void-elements, use-sync-external-store/shim).
  • optimizeDeps.exclude: ['backend.ai-ui', 'i18next', 'react-i18next'] — intentional; see the follow-up commit that explains the i18n dual-instance requirement.

Test plan

  • pnpm run vite:dev serves the app at localhost:9083 with HMR working
  • React Compiler 'use memo' annotations are applied (manual diff verified post-build)
  • Relay graphql\`tagged templates resolve togenerated/*` imports

Stack

Part of the Vite migration stack: FR-2606FR-2607FR-2610FR-2608FR-2609FR-2611 + fixes.

Copy link
Copy Markdown
Contributor Author

nowgnuesLee commented Apr 22, 2026


How to use the Graphite Merge Queue

Add either label to this PR to merge it via the merge queue:

  • flow:merge-queue - adds this PR to the back of the merge queue
  • flow:hotfix - for urgent changes, fast-track this PR to the front of the merge queue

You must have a Graphite account in order to use the merge queue. Sign up using this link.

An organization admin has required the Graphite Merge Queue in this repository.

Please do not merge from GitHub as this will restart CI on PRs being processed by the merge queue.

This stack of pull requests is managed by Graphite. Learn more about stacking.

@nowgnuesLee nowgnuesLee force-pushed the 04-20-feat_fr-2606_vite_poc_phase_1_dev_server_hmr_react_compiler_parity branch from bf0e617 to 7cb1e84 Compare April 27, 2026 13:57
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Apr 27, 2026

Coverage report for ./react

St.
Category Percentage Covered / Total
🔴 Statements
8.12% (+0% 🔼)
1859/22905
🔴 Branches 7.35% 1187/16156
🔴 Functions
4.83% (+0.02% 🔼)
297/6154
🔴 Lines
7.89% (+0% 🔼)
1750/22190

Test suite run success

865 tests passing in 40 suites.

Report generated by 🧪jest coverage report action from 4ac49a9

@nowgnuesLee nowgnuesLee marked this pull request as ready for review April 28, 2026 04:25
Copilot AI review requested due to automatic review settings April 28, 2026 04:25
Copy link
Copy Markdown
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

Adds an initial Vite-based dev-server setup for the react/ workspace to support the Phase 1 PoC of migrating off CRA/Craco while preserving dev-mode behavior (HMR, Relay artifacts, React Compiler annotations, and project-root static asset serving).

Changes:

  • Introduces react/vite.config.ts with Vite dev server config, custom project-root static middleware, HTML transforms, Relay artifact directory routing, SVGR, and Node polyfills.
  • Adds a vite:dev script and Vite-related devDependencies in react/package.json.
  • Documents Phase 1 scope, validation steps, and follow-ups in react/VITE_POC_NOTES.md.

Reviewed changes

Copilot reviewed 3 out of 4 changed files in this pull request and generated 4 comments.

File Description
react/vite.config.ts New Vite config + dev-server middleware to mirror Craco/Cra dev behavior and Babel plugin parity (React Compiler + Relay).
react/package.json Adds vite:dev script and Vite/plugin devDependencies for the PoC.
react/VITE_POC_NOTES.md Captures PoC rationale, verification evidence, and known follow-ups.

Comment thread react/vite.config.ts Outdated
Comment thread react/vite.config.ts
Comment thread react/vite.config.ts
Comment thread react/vite.config.ts
@nowgnuesLee nowgnuesLee force-pushed the 04-20-feat_fr-2606_vite_poc_phase_1_dev_server_hmr_react_compiler_parity branch from 7cb1e84 to c115607 Compare April 28, 2026 05:02
@yomybaby yomybaby force-pushed the 04-20-feat_fr-2606_vite_poc_phase_1_dev_server_hmr_react_compiler_parity branch from c115607 to 7807fa6 Compare April 30, 2026 12:08
@graphite-app
Copy link
Copy Markdown

graphite-app Bot commented Apr 30, 2026

Merge activity

…arity (#6869)

Resolves #6809(FR-2606)

## Summary

First commit of the Vite migration stack. Stands up a working Vite dev server that mirrors the CRA/Craco dev behaviour so downstream commits can iterate safely.

- `react/vite.config.ts`: `@vitejs/plugin-react` with `babel-plugin-react-compiler` (annotation mode), `babel-plugin-relay`, and `vite-plugin-svgr`. React Compiler parity with the existing CRA babel config.
- `projectRootStaticPlugin`: serves `/resources/`, `/manifest/`, `/dist/`, `/config.toml`, etc. from the project root and reads the real project-root `index.html` as the SPA template (replaces craco `devServer.static` + `HtmlWebpackPlugin`).
- `transformIndexHtml` hook injects `/src/index.tsx`, strips `{{nonce}}` in dev, and shims `process.env.NODE_ENV = 'development'` so dev-only branches still work.
- Module aliases for `src/`, `backend.ai-ui` workspace source, `backend.ai-client-esm` (from `dist/lib`), and ESM shims for CJS leaf deps (`void-elements`, `use-sync-external-store/shim`).
- `optimizeDeps.exclude: ['backend.ai-ui', 'i18next', 'react-i18next']` — intentional; see the follow-up commit that explains the i18n dual-instance requirement.

## Test plan

- [x] `pnpm run vite:dev` serves the app at localhost:9083 with HMR working
- [x] React Compiler `'use memo'` annotations are applied (manual diff verified post-build)
- [x] Relay `graphql\`\`` tagged templates resolve to `__generated__/*` imports

## Stack

Part of the Vite migration stack: FR-2606FR-2607FR-2610FR-2608FR-2609FR-2611 + fixes.
@graphite-app graphite-app Bot force-pushed the 04-20-feat_fr-2606_vite_poc_phase_1_dev_server_hmr_react_compiler_parity branch from 7807fa6 to 4ac49a9 Compare April 30, 2026 12:12
@graphite-app graphite-app Bot merged commit 4ac49a9 into main Apr 30, 2026
12 checks passed
@graphite-app graphite-app Bot deleted the 04-20-feat_fr-2606_vite_poc_phase_1_dev_server_hmr_react_compiler_parity branch April 30, 2026 12:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Vite PoC Phase 1: dev server + HMR parity for react/ and backend.ai-ui

2 participants