Replies: 1 comment
|
Sounds good, feel free to open PR |
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
CSS files that
global.css(thecssEntryFile) pulls in via@importnever enter Metro's module graph. Editing one of them produces no graph delta, so the CSS entry is not re-transformed and nothing hot reloads until you also saveglobal.cssor any JS file. Same as #248, which was closed for lack of a repro.Root cause
compileTailwind.tspassesonDependency: () => void 0to Tailwind'scompile(). Tailwind reports every@import-resolved stylesheet there; the information is discarded.cssEntryFileas CSS, and the virtual module it emits declares no dependencies, so Metro never watches the imported files.Repro (Expo SDK 57, RN 0.86, uniwind 1.12.0, iOS dev client)
global.css:@import "./src/components/ui/chip/tokens.css";tokens.css:@theme static { --color-chip-primary: var(--color-blue-500); }<View className="bg-chip-primary" />, then change the value intokens.cssonly and save.Nothing updates, also not after a JS reload. Saving
global.csswith a comment-only change applies it in ~80 ms. Adding a side-effectimport "./tokens.css"to any JS module fixes it (Expo compiles non-web.cssto an empty module), which shows Metro tracking is the only missing piece.Proposed fix (native, ~20 lines)
compileTailwind: collect the.csspaths outsidenode_modulesthat Tailwind reports throughonDependency.transform, native branch: prepend onerequire("<path relative to cssEntryFile>")per collected path to the virtual module. Expo turns those into empty modules, so the only effect is that Metro tracks the files and their edits produce a delta; the existingskipCache+traverseDependenciespatch does the rest.We run exactly this as a local
bun patchon 1.12.0 and verified three token-only edits hot reload on device without any JS import. Open points: plain Metro (non-Expo) needs an empty-module shim for.css, and web is untouched. Happy to open a PR if this direction works for you.All reactions