Skip to content

Fix Windows CI for the Turbopack loader changes#72

Open
esetnik wants to merge 2 commits into
markdoc:revert-69-revert-67-mainfrom
esetnik:fix/turbopack-windows-paths
Open

Fix Windows CI for the Turbopack loader changes#72
esetnik wants to merge 2 commits into
markdoc:revert-69-revert-67-mainfrom
esetnik:fix/turbopack-windows-paths

Conversation

@esetnik

@esetnik esetnik commented Jul 7, 2026

Copy link
Copy Markdown

This targets the #70 retry branch and fixes the windows-latest CI failure that got #67 reverted in #69 — without updating any snapshots. The failures turned out to be three real cross-platform bugs, so npm run test -- -u on Windows would have masked them (and produced snapshots that fail on Linux):

  1. getRelativeImportPath emitted OS-native separators. path.relative produces backslashes on Windows and the old normalize() helper double-escaped them into the emitted import specifiers — making loader output differ per OS (the snapshot failures) and emitting separators bundlers don't treat as path delimiters. Now converts to posix separators, so emitted code is byte-identical on every platform; the previously-unused normalize() helper is removed.
  2. The emitted path metadata carried backslashes on Windows (this.resourcePath.split('pages')[1]), failing the cross-platform toEqual assertions Enhance Turbopack support and improve loader functionality #67 added and shipping OS-dependent path values to the app. Normalized to posix, with a guard for non-page resources (e.g. .md imported as a component) where the split yields undefined.
  3. A test bug: the import as frontend component test replaced a posix-joined substring inside a path.join-built resourcePath, which never matches on Windows — so on Windows that test silently exercised the page pathway.

Proof: this exact CI matrix passes on both platforms on my fork: ubuntu + windows green (vs the branch without these fixes failing windows). All 18 tests / 4 snapshots pass unmodified.

Context: we run @markdoc/next.js on Next 16 under Turbopack in production (via a local shim replicating #67's resolution fixes) and would love to retire the shim when 0.6.0 (#68) ships — happy to adjust anything here.

Authored with Claude (AI) under my direction and review; commits carry co-author attribution.

esetnik and others added 2 commits July 7, 2026 07:23
The emitted file path (this.resourcePath split at pages/app) carries
backslashes on Windows, failing the cross-platform toEqual assertions
added in markdoc#67 and shipping OS-dependent path metadata to the app.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
The 'import as frontend component' test replaced a posix-joined
substring inside a path.join-built resourcePath, which never matched
on Windows — leaving the test exercising the page pathway there.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant