Repository navigation
fix(plugins): fail production builds on theme errors instead of an empty theme - #924
Merged
Merged
Conversation
`loadDevupConfig` turned a file that is not valid JSON into `{}`, so a typo
silently dropped the whole theme, and it followed `extends` cycles until the
stack overflowed. Both are now errors that name the file and how to fix it,
as is a config that is not a JSON object. An `extends` target that does not
exist yet stays an empty config: the dev servers watch it and load it once it
appears.
Vite, webpack and Rsbuild already log a config error and clear the theme; Bun
swallowed it and now logs it too.
`theme.d.ts` is written even when the theme has no tokens, so tokens removed
from devup.json leave no stale declarations behind (Vite, webpack, Rsbuild and
Next.js; Bun already did). Rsbuild creates the CSS directory before writing
into it, like Vite, so a cold start cannot lose the race with ENOENT.
Refs #686 (PLG-19, PLG-09, PLG-10)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…pty theme writeDataFiles in the Vite, webpack, Rsbuild and Bun plugins caught every error from loading devup.json and registering the theme, logged it and went on with an empty theme, so an invalid token or a CSS variable clash between token kinds shipped unstyled output from a build that succeeded. One-shot builds now rethrow the error. Watchers keep running on an empty theme, since devup.json may be mid-edit, and report it through the bundler: Vite sends the error overlay in place of the reload, webpack (and Next.js on webpack) and Rsbuild push it into every compilation's errors until the theme loads again, and a Bun reload logs it. Rsbuild now reads the Tailwind CSS files before registering the theme, so a failed registration still watches them. Refs #686 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
6 of 8 tasks
Codecov Report✅ All modified and coverable lines are covered by tests.
... and 9 files with indirect coverage changes 🚀 New features to boost your workflow:
|
This was referenced Nov 15, 2026
Conflicts: - bun-plugin/src/plugin.ts: main (#916) kept the empty-theme fallback with a console.error; kept this branch's writeDataFiles, which rethrows on the first load and only clears the theme on a Tailwind CSS reload. - bun-plugin/src/__tests__/plugin.test.ts: replaced main's "registers an empty theme" expectation with this branch's rejection tests. - rsbuild-plugin/src/plugin.ts: kept registering the theme after reading the Tailwind CSS files and returning { tailwindFiles, themeError }. - webpack-plugin/src/plugin.ts: kept clearing themeError after a successful load; main's #945 warnings and #951 file removal merged cleanly around it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
owjs3901
added a commit
that referenced
this pull request
Nov 17, 2026
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>
owjs3901
added a commit
that referenced
this pull request
Nov 17, 2026
Resolve the conflict with #924 in the Bun plugin: keep this branch's `createSourceFilter` for `include` and take main's `writeDataFiles`, which rejects a theme error on the first load and reports it only on a reload. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
owjs3901
added a commit
that referenced
this pull request
Nov 17, 2026
Resolve the conflict with #924 in the Bun plugin: writeDataFiles takes the located project, so devup.json, df and the CSS directory still resolve against the project root, and takes main's `reloading` flag after it. The first load rejects a theme error; the Tailwind CSS watcher reloads the same project with `reloading` set, so it reports the error and clears the theme. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
owjs3901
added a commit
that referenced
this pull request
Nov 17, 2026
Resolve the conflicts with #924 and #960. The Bun plugin keeps bunConditions, withDependencyImports and sourceLoader and takes main's writeDataFiles, which rejects a theme error on the first load. In Vite, webpack and Rsbuild main moved the source transform into one handler shared with the MDX post transform; that handler now matches SOURCE_FILE_REGEX, so .mts/.cts/.cjs modules are extracted, and Rsbuild's handler still sets the environment's module resolver. Main's Rsbuild MDX test now looks the source transform up by SOURCE_FILE_REGEX. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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
감사 원칙(#682): 빌드 타임에 아무것도 조용히 넘어가면 안 되고, 프로덕션 빌드는 실패해야 합니다.
문제
Vite, webpack, Rsbuild, Bun 플러그인의
writeDataFiles는loadDevupConfig+compiler.registerTheme(...)를 try/catch로 감싸console.error만 하고 빈 테마(registerTheme({}))로 계속 진행했습니다. 그래서 다음 오류가 모두 삼켜지고, 빌드는 성공한 채 스타일이 빠진 결과물이 나갔습니다.theme: color token 'card' and shadow token 'card' both become the CSS variable --card)Next.js는 webpack 경로가 webpack 플러그인을 거치므로 같은 문제가 있었고, Turbopack 경로는 원래 삼키지 않습니다.
변경
vite build(command === 'build'이고build.watch없음)이면configResolved가 reject됩니다.watch: false이면apply()에서 throw합니다. 기존apply경로대로endBuild()는 호출됩니다.api.context.action !== 'dev'이면setup이 reject됩니다.register()/Bun.build의 setup이 reject됩니다.serve또는vite build --watch.console.error로 출력하고, devup.json hot update가 실패하면full-reload대신{ type: 'error', err: { message, stack, plugin: 'devup-ui' } }를 보내 에러 오버레이를 띄웁니다 (Vite 6+environment.hot.send, Vite 5server.ws.send둘 다).console.error로 출력하고, 테마가 다시 로드될 때까지 매 compilation의compilation.errors에[devup-ui] <message>를WebpackError로 넣습니다.compilation.errors에 넣습니다. Tailwind CSS 변경 때문에 일어나는 리로드는rsbuild build에서도 watcher 안에서 돌기 때문에 watch 쪽으로 처리합니다.console.error후 빈 테마로 계속합니다.새 오류
registerTheme/loadDevupConfig오류 메시지 그대로 실패합니다 (예:theme: color token 'card' and shadow token 'card' both become the CSS variable --card,<file> is not valid JSON: ...).[devup-ui] <message>가 나오고, Vite에서는 에러 오버레이가 뜹니다.Test plan
bun --config=./bunfig.vite.toml test packages/vite-plugin/src/__tests__/plugin.test.ts: 626 pass. 추가한 테스트는 build에서 load / register 실패 시 reject, serve와build --watch에서 빈 테마로 계속, hot update에서 Error / stack 없는 Error / 문자열을 던졌을 때 오버레이를 보내고 reload하지 않는지입니다.bun test packages/webpack-plugin: 3568 pass,plugin.ts100%. 추가한 테스트는 일회성 빌드의applythrow, watch에서 매 compilation error 보고와 devup.json 복구 후 해제,config-errors.test.ts의 두 모드입니다.bun test packages/rsbuild-plugin/src/__tests__/plugin.test.ts: 568 pass,plugin.ts100%. 추가한 테스트는 build와 action 없음에서 reject, dev에서 compilation error 보고와 복구 후 해제, build 중 Tailwind 리로드 실패가 서버를 죽이지 않는지입니다.bun test packages/bun-plugin: 61 pass,plugin.ts100%. 추가한 테스트는 config read 실패와 register 실패 시 reject, Tailwind 리로드 실패 시 로그를 남기고 빈 테마로 가는지입니다.bunx prettier --single-quote --no-semi --check통과Refs #686
🤖 Generated with Claude Code