Skip to content

feat(FR-2610): Vite dev-reload plugin for i18n / theme / config.toml file changes#6872

Merged
graphite-app[bot] merged 1 commit intomainfrom
04-20-feat_fr-2610_vite_dev-reload_plugin_for_i18n___theme___config.toml_file_changes
Apr 30, 2026
Merged

feat(FR-2610): Vite dev-reload plugin for i18n / theme / config.toml file changes#6872
graphite-app[bot] merged 1 commit intomainfrom
04-20-feat_fr-2610_vite_dev-reload_plugin_for_i18n___theme___config.toml_file_changes

Conversation

@nowgnuesLee
Copy link
Copy Markdown
Contributor

@nowgnuesLee nowgnuesLee commented Apr 22, 2026

Resolves #6813(FR-2610)

Summary

Custom Vite plugin (devAssetsReloadPlugin) that triggers a full page reload whenever project-root, runtime-fetched assets change on disk. Mirrors the fs.watch / fs.watchFile setup in the old craco.config.cjs devServer block.

Why needed: i18next-http-backend fetches resources/i18n/*.json at runtime — those JSONs are NOT part of the Vite module graph, so Vite would never HMR them. A full reload is the only way to pick up an edit. config.toml, resources/theme.json, and the project-root index.html fall in the same category.

Watch targets:

  • config.toml
  • index.html
  • resources/i18n/*
  • resources/theme.json

Debounce: 300ms (matches craco). FSEvents on macOS can fire multiple watcher events for a single save; editors that use atomic-save (write temp → rename) produce two events. Debouncing collapses both into one reload signal.

Test plan

  • Edit resources/i18n/ko.json during vite:dev → page reloads within 300ms
  • Edit config.toml → page reloads
  • Edit resources/theme.json → page reloads
  • Rapid double-save produces ONE reload, not two

Stack

Builds on FR-2607.

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-2610_vite_dev-reload_plugin_for_i18n___theme___config.toml_file_changes branch from 5c37f96 to 5b738cf Compare April 27, 2026 13:57
@nowgnuesLee nowgnuesLee force-pushed the 04-20-feat_fr-2607_vite_spike_answer_es6___electron_publicpath_works_via_renderbuilturl branch from 1d2a0d7 to 311b4a9 Compare April 27, 2026 13:57
@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 a custom Vite dev-server plugin to force full-page reloads when runtime-fetched, project-root assets change on disk (i18n JSONs, theme.json, config.toml, root index.html), matching the legacy Craco fs.watch behavior so dev edits are picked up even though these files aren’t in Vite’s module graph.

Changes:

  • Introduce devAssetsReloadPlugin to watch specific project-root paths and trigger a debounced full-reload over Vite WS.
  • Update server.watch.ignored to ensure config.toml is not excluded from watching.
  • Document the migration/landing of the dev-reload behavior in VITE_POC_NOTES.md.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
react/vite.config.ts Adds a Vite dev plugin to watch runtime-fetched assets and emit debounced full reloads; adjusts watch ignore list and plugin ordering.
react/VITE_POC_NOTES.md Updates PoC notes to reflect that the fs.watch-equivalent reload behavior has landed under FR-2610.

Comment thread react/vite.config.ts Outdated
@nowgnuesLee nowgnuesLee force-pushed the 04-20-feat_fr-2610_vite_dev-reload_plugin_for_i18n___theme___config.toml_file_changes branch from 5b738cf to 3a0179a Compare April 28, 2026 05:02
@nowgnuesLee nowgnuesLee force-pushed the 04-20-feat_fr-2607_vite_spike_answer_es6___electron_publicpath_works_via_renderbuilturl branch from 311b4a9 to 119ae4c Compare April 28, 2026 05:02
@nowgnuesLee nowgnuesLee force-pushed the 04-20-feat_fr-2610_vite_dev-reload_plugin_for_i18n___theme___config.toml_file_changes branch from 3a0179a to b404929 Compare April 28, 2026 05:15
@nowgnuesLee nowgnuesLee force-pushed the 04-20-feat_fr-2607_vite_spike_answer_es6___electron_publicpath_works_via_renderbuilturl branch from 119ae4c to 8a8cdbd Compare April 28, 2026 05:15
@nowgnuesLee nowgnuesLee force-pushed the 04-20-feat_fr-2610_vite_dev-reload_plugin_for_i18n___theme___config.toml_file_changes branch from b404929 to d068319 Compare April 28, 2026 05:19
@nowgnuesLee nowgnuesLee force-pushed the 04-20-feat_fr-2607_vite_spike_answer_es6___electron_publicpath_works_via_renderbuilturl branch from 8a8cdbd to 77461db Compare April 28, 2026 05:19
@nowgnuesLee nowgnuesLee force-pushed the 04-20-feat_fr-2610_vite_dev-reload_plugin_for_i18n___theme___config.toml_file_changes branch from d068319 to 2c4b344 Compare April 28, 2026 05:25
@github-actions github-actions Bot added size:L 100~500 LoC and removed size:M 30~100 LoC labels Apr 28, 2026
@yomybaby yomybaby force-pushed the 04-20-feat_fr-2607_vite_spike_answer_es6___electron_publicpath_works_via_renderbuilturl branch from 77461db to f304a41 Compare April 30, 2026 12:08
@yomybaby yomybaby force-pushed the 04-20-feat_fr-2610_vite_dev-reload_plugin_for_i18n___theme___config.toml_file_changes branch from 2c4b344 to a2b2a81 Compare April 30, 2026 12:08
@graphite-app
Copy link
Copy Markdown

graphite-app Bot commented Apr 30, 2026

Merge activity

…file changes (#6872)

Resolves #6813(FR-2610)

## Summary

Custom Vite plugin (`devAssetsReloadPlugin`) that triggers a full page reload whenever project-root, runtime-fetched assets change on disk. Mirrors the `fs.watch` / `fs.watchFile` setup in the old `craco.config.cjs` devServer block.

**Why needed**: `i18next-http-backend` fetches `resources/i18n/*.json` at runtime — those JSONs are NOT part of the Vite module graph, so Vite would never HMR them. A full reload is the only way to pick up an edit. `config.toml`, `resources/theme.json`, and the project-root `index.html` fall in the same category.

**Watch targets**:
- `config.toml`
- `index.html`
- `resources/i18n/*`
- `resources/theme.json`

**Debounce**: 300ms (matches craco). FSEvents on macOS can fire multiple watcher events for a single save; editors that use atomic-save (write temp → rename) produce two events. Debouncing collapses both into one reload signal.

## Test plan

- [x] Edit `resources/i18n/ko.json` during `vite:dev` → page reloads within 300ms
- [x] Edit `config.toml` → page reloads
- [x] Edit `resources/theme.json` → page reloads
- [x] Rapid double-save produces ONE reload, not two

## Stack

Builds on FR-2607.
@graphite-app graphite-app Bot force-pushed the 04-20-feat_fr-2607_vite_spike_answer_es6___electron_publicpath_works_via_renderbuilturl branch from f304a41 to d7e4e36 Compare April 30, 2026 12:13
@graphite-app graphite-app Bot force-pushed the 04-20-feat_fr-2610_vite_dev-reload_plugin_for_i18n___theme___config.toml_file_changes branch from a2b2a81 to 19e4114 Compare April 30, 2026 12:14
Base automatically changed from 04-20-feat_fr-2607_vite_spike_answer_es6___electron_publicpath_works_via_renderbuilturl to main April 30, 2026 12:26
@graphite-app graphite-app Bot merged commit 19e4114 into main Apr 30, 2026
4 checks passed
@graphite-app graphite-app Bot deleted the 04-20-feat_fr-2610_vite_dev-reload_plugin_for_i18n___theme___config.toml_file_changes branch April 30, 2026 12:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:L 100~500 LoC

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Vite PoC Phase 2: fs.watch dev-server middlewares for i18n/theme/config.toml full reload

2 participants