fix(plugin): Windows cross-drive content-module crash (#6)#9
Merged
Conversation
Project on a different drive than the runtime (project E:\, global tangly
C:\) rendered pages blank. Astro stores `posixRelative(root, file)` as the
deferred-module fileName; cross-drive there's no relative path so the
absolute drive-letter path is stored, and `new URL("E:/…", root)` reads
`E:` as a URL scheme -> ERR_INVALID_URL_SCHEME.
Rewrite drive-letter fileNames in .astro/content-modules.mjs to file://
URLs (segments percent-encoded) inside the existing enforce:"pre" transform,
which runs before vite:import-analysis -- Astro's own pre content plugin
wins resolveId first, so a transform is the only reliable interception.
Inert on POSIX / same-drive.
Add scripts/smoke-winpath.ts: subst-maps a free drive letter to reproduce
cross-drive deterministically on the windows-latest CI leg and asserts the
page body renders.
Deploying with
|
| Status | Name | Latest Commit | Preview URL | Updated (UTC) |
|---|---|---|---|---|
| ✅ Deployment successful! View logs |
tangly-docs | 1280167 | Commit Preview URL Branch Preview URL |
Jun 11 2026, 09:43 PM |
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.
Fixes the issue #6 follow-up: a Windows user with their project on
E:\and a globaltanglyonC:\saw pages render blank.Root cause
Tangly runs Astro with
root= the runtime inside the installed package, while content lives atTANGLY_USER_ROOT. Astro's glob loader storesposixRelative(root, file)as the deferred-modulefileName. On Windows there's no relative path across drives, sopath.relative('C:\…','E:\…')returns the absolute target →E:/project/.../overview.mdxis stored. At render, Astro doesnew URL(fileName, root);E:parses as a URL scheme →ERR_INVALID_URL_SCHEME→ blank page. Only triggers when project drive ≠ install drive (so most users never hit it).Fix
Rewrite drive-letter
fileName=params in.astro/content-modules.mjstofile://URLs (path segments percent-encoded) inside tangly's existingenforce:"pre"transform. That hook runs before vite:import-analysisresolves the deferred imports. AresolveIdhook can't be used: Astro's own content plugin is alsoenforce:"pre"and ordered first, so it winsresolveIdand crashes before ours runs. Inert on POSIX / same-drive Windows.Regression gate
scripts/smoke-winpath.ts(new)subst-maps a free drive letter to reproduce cross-drive deterministically —path.relativekeys off the drive letter, not the volume — runstangly build --root <letter>:\, and asserts the page body renders. Wired into thewindows-latestleg of thesmokejob inci.yml. So the bug is gated in CI before every release.Tests
content-modules-winpath.test.tsreproduces the exactcontent-modules.mjsfrom the issue log; covers the#/%-in-filename round-trip.Local: 133 tangly tests + full suite green,
bun run checkclean. The cross-drive smoke can only be validated on the Windows CI runner.