Repository navigation
fix(example): flatten Windows segment prefetch files in react demo - #131
Merged
Merged
Conversation
Next 16 static export names each segment prefetch file from path.relative, which gives backslashes on Windows, so a Windows build writes wizard/__next.wizard/__PAGE__.txt instead of wizard/__next.wizard.__PAGE__.txt. Every link prefetch then 404s on load (vercel/next.js#85374, fix in #92340). A postbuild step moves those files back to the flat, dotted name. Linux builds (the Pages workflow) have no such folders, so it is a no-op there.
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.
What
The React demo logged three 404s on load when built on Windows:
GET /wizard/__next.wizard.__PAGE__.txt?_rsc=...(same for/new-features/,/schema-form/).Root cause
A Next.js 16 static export bug on Windows, not our config
(vercel/next.js#85374, open; fix in
#92340, not merged; still in canary).
The export collects segment files with
path.relative, which returns backslashes on Windows,and only turns
/into.. So a Windows build writeswizard/__next.wizard/__PAGE__.txt(a folder) while the client asks for
wizard/__next.wizard.__PAGE__.txt.No Next option (
trailingSlashetc.) changes this.The deployed site is built on ubuntu and is already clean: all 8
.txtprefetches return 200and the console has no errors on https://vannt-dev.github.io/dynamic-field-kit/react/.
Fix
example/react-app/scripts/flatten-segment-files.js, wired aspostbuild, moves any fileunder an
out/**/__next.*/folder back to the flat, dotted name. It does nothing onLinux/macOS. Remove it once the upstream fix ships. Prefetching stays on.
Verification (Windows, Chromium via Playwright,
python -m http.server)PAGES_BASE_PATH=/dynamic-field-kit/react: 3 console errors, the three__PAGE__.txtprefetches 404.__PAGE__.txtand_tree.txtprefetches 200.Clicked Wizard, JSON Schema + Undo, Form state, Basics: URL and heading change and a
windowmarker survives, so navigation is client-side./): same result, 0 errors, 0 404s in the server log.out/is a no-op.Empty changeset: no published package changes.