mirror of
https://github.com/cloudflare/vinext.git
synced 2026-05-09 08:25:34 +02:00
[PR #292] [MERGED] fix: ensure clientDir exists before writing _headers file #451
Labels
No labels
enhancement
enhancement
good first issue
help wanted
nextjs-tracking
nextjs-tracking
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/vinext#451
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/cloudflare/vinext/pull/292
Author: @Divkix
Created: 3/6/2026
Status: ✅ Merged
Merged: 3/6/2026
Merged by: @james-elicx
Base:
main← Head:fix/headers-enoent📝 Commits (1)
dc2e0f0fix: ensure clientDir exists before writing _headers file📊 Changes
1 file changed (+1 additions, -0 deletions)
View changed files
📝
packages/vinext/src/index.ts(+1 -0)📄 Description
Summary
closeBundlehook writes_headerstoclientDir(dist/client/) without creating the directory first. OnlydistDir(dist/) is checked earlier in the hook.dist/client/may not exist yet, causing an ENOENT error onwriteFileSync.fs.mkdirSync(clientDir, { recursive: true })before the write.recursive: trueis a no-op if the directory already exists, so this is safe on warm builds.Reproduction
dist/entirely (simulating cache invalidation)bun run buildENOENT: no such file or directory, open 'dist/client/_headers'Fix
Single line addition at
packages/vinext/src/index.ts— ensures the directory exists before writing.Test plan
rm -rf dist && bun run build) succeeds without ENOENTbun run buildwith existingdist/) still succeeds (no-opmkdirSync)dist/client/_headersfile is generated with correct cache headers🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.