Skip to content

turbo build inputs: the root postcss.config.mjs is a dormant fifth instance of the #3514 class — outside every build program only by coincidence #4198

Description

@yinlianghui

Found while measuring the build derivation for #4185. Not a live defect today — filed as an observation so the next reader does not have to re-measure it, and so the coincidence keeping it dormant is on the record rather than in one agent's head.

What is dormant

Vite hands CSS to postcss-load-config, which searches upward from the Vite root. So a package whose vite build processes CSS and which has no postcss.config.* of its own would read the repo-root postcss.config.mjs — a file outside its own directory, and therefore invisible to turbo's build cache key exactly as the root tsconfig.json was before #4185.

The guard that ships with #4185 (scripts/__tests__/helpers/build-program.ts) does not model postcss config discovery, and deliberately so: it would mean reproducing a plugin-adjacent resolution whose defaults drift between versions. That decision is sound only while nothing reaches the root config.

Why it is dormant — measured, both halves

Nothing reaches it, because two independent facts happen to hold at once:

  1. Every vite build package that actually processes CSS carries its own postcss config, which stops the upward walk before the repo root: apps/console, packages/components, packages/runner, examples/console-starter, examples/byo-backend-console.
  2. packages/fields is the only vite build package with no postcss config of its own, and it does have a CSS file — but packages/fields/src/index.css never enters the Vite graph. Nothing imports it: packages/fields/scripts/build-css.mjs compiles it separately, invoking postcss with an explicit plugin list (postcss([tailwindPostcss()])) that reads no config file at all.

Remove either fact and the root config silently becomes part of a build program.

Why it is worth recording

The trigger is one line. Adding import './index.css' to packages/fields/src/index.tsx — an ordinary-looking change, and the shape every other CSS-carrying package already uses — would pull the repo-root postcss.config.mjs into that package's build program. Turbo would not hash it, build would replay a stale dist/, and #4185's guard would stay green, because the derivation does not follow postcss.

That is the same "looks like enforcement, isn't" shape the class keeps producing, with the twist that the guard's own blind spot is what hides it.

Options, if this is ever picked up

C is what is in place. B looks like the cheapest thing that would actually retire the risk, but it is a judgement call about a file no user hits today, so this is filed unassigned and unqueued for triage rather than fixed inside #4185's scope.

Related


Generated by Claude Code

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions