fix(ui): rebuild dist automatically on CSS Modules changes in dev - #186
Open
gohabereg wants to merge 1 commit into
Open
fix(ui): rebuild dist automatically on CSS Modules changes in dev#186gohabereg wants to merge 1 commit into
gohabereg wants to merge 1 commit into
Conversation
vite build --watch relies on Rollup's dependency graph to know what to rebuild, but our CSS Modules (.pcss) pipeline never registers that graph edge, so editing a .pcss file alone never triggered a rebuild. Only editing a .ts file did, which then happened to pick up whatever CSS was on disk at the time - making it look like the ui package "doesn't rebuild automatically" in the playground's dev command. Switch ui's dev script to chokidar-cli, which watches every file under src and reruns a full `yarn build` on any change, sidestepping the broken dependency tracking entirely. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
ilyamore88
approved these changes
Jul 25, 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
playground'sdevcommand builds the whole workspace and watches for changes, but theuipackage never rebuilt automatically after the initial build — only a manualyarn buildpicked up changes.ui'sdevscript (vite build --watch) relies on Rollup's dependency graph to decide what to rebuild. Our CSS Modules (.pcss) pipeline never registers that graph edge, so editing a.pcssfile alone never triggered a rebuild. Editing a.tsfile did trigger one, and it happened to pick up whatever CSS was on disk at that moment — which made it look likeuijust doesn't watch, since most day-to-day work on this package is CSS.ui'sdevscript tochokidar-cli, which watches every file undersrc(any type) and reruns a fullyarn buildper change, sidestepping Rollup's incomplete CSS dependency tracking. Left a comment invite.config.tsexplaining whyvite build --watchisn't used directly, since it's a non-obvious workaround for a caching bug invite-plugin-css-injected-by-js(confirmed by reproducing the same one-rebuild-behind staleness across three different CSS pipelines: postcss-modules,vite-css-modules, and native Lightning CSS).Test plan
yarn buildinpackages/uisucceedsyarn devend-to-end; edited a.pcss-only change and confirmeddist/ui.jsrebuilds automatically and renders correctly in the browser on refresh, with no manualyarn buildneeded🤖 Generated with Claude Code