Repository navigation
fix(plugins): watch the configs devup.json extends in webpack and Rsbuild - #928
Merged
Merged
Conversation
…uild Vite collects every file loadDevupConfig reads through extends and watches them. webpack watched only a devup.json that existed when apply ran, and Rsbuild did not reload devup.json in dev at all, so editing a base theme, or adding or deleting devup.json, left the old CSS, types and default theme in place (PLG-08). Both now pass an inputs set to loadDevupConfig and keep the files it names. webpack stamps them in watchRun and adds them to each compilation's file dependencies, or its missing dependencies while one does not exist; Rsbuild stamps them in watchRun and adds them to each transformed module's dependencies, or missing dependencies. A changed, added or deleted config reloads the theme. Refs #686 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Codecov Report✅ All modified and coverable lines are covered by tests.
🚀 New features to boost your workflow:
|
This was referenced Nov 15, 2026
Conflicts in rsbuild-plugin/src/plugin.ts:
- writeDataFiles: kept main's sequential mkdir and stylesheet write
(the cold-start ENOENT fix) and returned this branch's
{ tailwindFiles, configFiles }.
- JS transform: kept main's hoisted excludeRegex (#914) and added this
branch's addMissingDependency and config-file dependencies.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Resolve the conflicts with #924. Rsbuild's writeDataFiles takes the `watching` flag again and returns one flat `{ tailwindFiles, configFiles, themeError }`, so the watcher keeps both the extends chain and the theme error. webpack keeps `configFiles` and `themeError` side by side: the catch records the error (or rethrows in a one-shot build) and the `finally` still records the config chain. Both sides' tests are kept. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
6 tasks done
Resolve the conflict with #960 in Rsbuild: main moved the source transform into one handler shared with the MDX post transform. That handler now also registers devup.json and the configs it extends, existing ones with addDependency and missing ones with addMissingDependency, so MDX modules reload the theme too. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Pick up the #983 snapshot fix so CI runs against current main. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
owjs3901
added a commit
that referenced
this pull request
Nov 17, 2026
Keep #947's ThemeProvider limitation next to this branch's Bun line, which now also names the packages in include. Rsbuild transforms take both #928's addMissingDependency and this branch's environment, so the merged tests pass both, including #957's hook tests that predate addMissingDependency. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
owjs3901
added a commit
that referenced
this pull request
Nov 17, 2026
Bring in #963 (per-session engine state) and #928. The only conflict was the module list in libs/extractor/src/lib.rs, where main re-exports ExtractorCaches next to this branch's vanilla_extract_calc module; both are kept. The calc compiler adds no process-wide state, so nothing joins the session swap. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
4 of 6 tasks
owjs3901
added a commit
that referenced
this pull request
Nov 17, 2026
#963 keeps the CSS state of an engine session in CssState; carry the license banner there too (stored inverted so a fresh session keeps it on), so the test guard and session swaps restore it. #990 counts 46 validated argument positions; setLicenseBanner.enabled makes 47. Set the banner next to #962's project-root setup in Rsbuild and Bun, keep both README sections, and pass #928's inputs Set in #962's webpack project-root assertion. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
owjs3901
added a commit
that referenced
this pull request
Nov 17, 2026
#962 resolves the project from the bundler root: the Rsbuild and webpack source graphs, canonical maps and resolver ids now use that root instead of the cwd (the graph tests follow), while this branch keeps its source filters and per-environment bundler conditions. The webpack loader caches one resolver per root and condition set; Bun passes its project and conditions to initialize. Also pass #928's inputs Set in #962's webpack project-root assertion. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
owjs3901
added a commit
that referenced
this pull request
Nov 17, 2026
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
Fixes the part of #686's PLG-08 that remained in webpack and Rsbuild, the way Vite does it: they did not watch the config files that devup.json
extends.Problem
extends, vialoadDevupConfig(devupFile, inputs).devup.jsonthat existed atapplytime (existsDevupwas captured once inapply).devup.jsonitself in dev; it watched only Tailwind CSS files.devup.json, left the old CSS,theme.d.ts, and default theme in place.Change
writeDataFilespasses aninputsset toloadDevupConfigSyncand stores devup.json and the whole extends chain inconfigFiles, including files that don't exist.watchRunstamps the mtimes ofconfigFilesand the Tailwind files. Missing files count as 0. If they change, the theme is re-read.afterCompileis always registered. Existing configs go intofileDependencies, and configs that don't exist yet go intomissingDependencies, so their creation is detected too.writeDataFilesreturns{ tailwindFiles, configFiles }.watchRunstamp includes the config files.addDependencyand missing configs withaddMissingDependency. So when a config is edited, added, or deleted, modules are rebuilt and the theme is re-read.addMissingDependencyto the transform context in the test mock. It is a required field in the Rsbuild types.PLG-13 is not in this PR
Vite's PLG-13 fix moves the atom-hoist / canonical map pre-pass into the reservation's
beforeReserveand computes it over the reservation inventory's import graph (reservationGraph(inventory)). That graph coverssrc,app, the entry closure, andinclude. Applying the same structure to webpack and Rsbuild brings along the following.apply/setuptorun/watchRun.createSharedSlotReservationis mocked, sobeforeReserveis not called) would need rewriting.productionPrewarmFilesthrow semantics would also need to be realigned.So it is left as separate work.
New errors
None.
Note
This touches the same
writeDataFilesas #924 (fail the build on theme errors), so whichever merges later needs to resolve the conflict. On the webpack side,configFilesis recorded infinally, so it also works with #924's rethrow.Test plan
bun test packages/webpack-plugin: 3565 pass,plugin.ts100%configFilesandfileDependencies, it reloads when the base is edited or deleted, and it is not re-read when unchangedshould applymatrix: updated expectations so it stats and adds tomissingDependencieseven when devup.json doesn't existbun test packages/rsbuild-plugin: 599 pass,plugin.ts100%addDependencyand deleted configs viaaddMissingDependencytsc --noEmit(webpack, rsbuild),bunx prettier --single-quote --no-semi --checkpass요약
#686의 PLG-08 중 webpack·Rsbuild에 남아 있던 부분을 Vite처럼 고칩니다. devup.json이
extends하는 config 파일들을 감시하지 않던 문제입니다.문제
loadDevupConfig(devupFile, inputs)로extends를 따라 읽은 파일을 모두 모아 감시합니다.apply시점에 존재하던devup.json하나만 감시했습니다 (existsDevup를apply에서 한 번만 캡처).devup.json자체도 다시 읽지 않았고, Tailwind CSS 파일만 감시했습니다.devup.json을 추가·삭제해도 예전 CSS,theme.d.ts, default theme이 그대로 남았습니다.변경
writeDataFiles가inputsset을loadDevupConfigSync에 넘기고,configFiles에 devup.json과 extends 체인 전체를 저장합니다. 존재하지 않는 파일도 포함합니다.watchRun이configFiles와 Tailwind 파일의 mtime을 stamp합니다. 없는 파일은 0으로 칩니다. 바뀌면 테마를 다시 읽습니다.afterCompile은 항상 등록됩니다. 존재하는 config는fileDependencies에, 아직 없는 config는missingDependencies에 넣어 생성도 감지합니다.writeDataFiles가{ tailwindFiles, configFiles }를 반환합니다.watchRunstamp에 config 파일이 포함됩니다.addDependency로, 없는 config는addMissingDependency로 등록합니다. 그래서 config가 편집·추가·삭제되면 모듈이 다시 빌드되고 테마도 다시 읽힙니다.addMissingDependency를 추가했습니다. Rsbuild 타입에서 필수 필드입니다.PLG-13은 이 PR에 넣지 않았습니다
Vite의 PLG-13 수정은 atom-hoist / canonical map pre-pass를 reservation의
beforeReserve로 옮기고, reservation inventory의 import graph(reservationGraph(inventory)) 위에서 계산하는 방식입니다. 이 graph는src,app, entry closure,include를 모두 포함합니다. webpack·Rsbuild에 같은 구조를 적용하려면 다음이 따라옵니다.apply/setup에서run/watchRun으로 바뀝니다.createSharedSlotReservation이 mock되어beforeReserve가 호출되지 않음)을 다시 써야 합니다.productionPrewarmFilesthrow 의미론도 다시 맞춰야 합니다.그래서 별도 작업으로 남깁니다.
새 오류
없음.
참고
#924(테마 오류 시 빌드 실패)와 같은
writeDataFiles를 건드리므로, 둘 중 나중에 머지되는 쪽에서 충돌을 풀어야 합니다. webpack 쪽은finally에서configFiles를 기록하므로 #924의 rethrow와도 함께 동작합니다.테스트 계획
bun test packages/webpack-plugin: 3565 pass,plugin.ts100%configFiles·fileDependencies에 들어가는지, base 편집과 삭제 때 다시 로드되는지, 바뀌지 않으면 다시 읽지 않는지should applymatrix: devup.json이 없을 때도 stat하고missingDependencies에 넣도록 기대값 수정bun test packages/rsbuild-plugin: 599 pass,plugin.ts100%addDependency, 삭제된 config는addMissingDependency로 넣는지tsc --noEmit(webpack, rsbuild),bunx prettier --single-quote --no-semi --check통과Refs #686
🤖 Generated with Claude Code