Skip to content

chore(examples): ignore the generated vite config output - #222

Merged
pasevin merged 1 commit into
mainfrom
chore/ignore-generated-example-config
Aug 24, 2026
Merged

chore(examples): ignore the generated vite config output#222
pasevin merged 1 commit into
mainfrom
chore/ignore-generated-example-config

Conversation

@pasevin

@pasevin pasevin commented Aug 24, 2026

Copy link
Copy Markdown
Collaborator

Correcting the premise

This started as "add an examples build to CI". On checking, the example is already built in CIexamples/* is in pnpm-workspace.yaml and the root build script is pnpm -r build, which CI runs. I verified it: a root build produces 200 log lines from examples/basic-react-app. So there is no CI gap to close.

The real problem is different, and it is the root cause of the broken example build we hit earlier.

What is actually wrong

examples/basic-react-app builds with tsc -b && vite build, and its tsconfig.node.json is a composite project whose include list is ["vite.config.ts"]. So tsc -b emits vite.config.js and vite.config.d.ts on every build — they are build output, not source.

.gitignore covered *.tsbuildinfo but not those two. They therefore appeared as untracked files after any build, and at some point were committed by accident.

That mattered because Vite resolves vite.config.js ahead of vite.config.ts. The committed copy became the config that actually took effect, so every alias had to be written twice, and the file that won was the generated one.

Why CI never caught the breakage this caused

This is the part worth knowing, and I had it wrong before:

  • In CI a fresh checkout has no tsconfig.node.tsbuildinfo, so tsc -b re-emits vite.config.js from the .ts. CI silently gets a correct config and passes.
  • Locally a cached tsbuildinfo makes tsc treat the project as up to date and skip the emit, leaving the stale committed .js in place for Vite to prefer.

Green in CI, broken on any machine that had built before. Adding a CI build step would not have caught it — CI was already building the example and still could not see the problem.

The change

Two .gitignore lines, plus a comment explaining the mechanism so the next person does not re-commit them:

examples/*/vite.config.js
examples/*/vite.config.d.ts

The tracked copies were already removed in #221. This stops them coming back.

Verification

  • deleted both files and the tsbuildinfo, then built: ✓ built in 13.61s, and tsc -b regenerated both — confirming they are genuinely build output
  • after that build, git status shows 0 untracked files under examples/ (was 2)
  • root pnpm build (what CI runs) passes and does include the example

examples/basic-react-app builds with `tsc -b && vite build`, and its
tsconfig.node.json is a composite project whose include list is
["vite.config.ts"] -- so `tsc -b` emits vite.config.js and vite.config.d.ts
on every build. Only *.tsbuildinfo was ignored, so the other two appeared as
untracked after any build and were committed by accident once.

That mattered because Vite resolves vite.config.js ahead of vite.config.ts.
The committed copy became the config that actually took effect, so every alias
had to be written twice, and the file that won was the generated one.

It also explains why CI never caught the resulting breakage. A fresh checkout
has no tsbuildinfo, so tsc re-emits vite.config.js from the .ts and CI gets a
correct config. Locally a cached tsbuildinfo makes tsc treat the project as up
to date and skip the emit, leaving the stale committed .js for Vite to prefer.
Green in CI, broken on any machine that had built before.

The tracked copies are already gone. This stops them coming back.
@pasevin
pasevin requested a review from a team as a code owner August 24, 2026 15:35
@netlify

netlify Bot commented Aug 24, 2026

Copy link
Copy Markdown

Deploy Preview for openzeppelin-ui ready!

Name Link
🔨 Latest commit 391e1d9
🔍 Latest deploy log https://app.netlify.com/projects/openzeppelin-ui/deploys/6a8c64ae9b896e00083ca4dd
😎 Deploy Preview https://deploy-preview-222--openzeppelin-ui.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@pasevin
pasevin merged commit 1276471 into main Aug 24, 2026
14 checks passed
@pasevin
pasevin deleted the chore/ignore-generated-example-config branch August 24, 2026 15:43
@github-actions github-actions Bot locked and limited conversation to collaborators Aug 24, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant