Skip to content

fix(build): normalize Windows path separators in rollup external check - #423

Open
andreas-karlsson wants to merge 1 commit into
mainfrom
fix/rollup-normalize-path-windows
Open

fix(build): normalize Windows path separators in rollup external check#423
andreas-karlsson wants to merge 1 commit into
mainfrom
fix/rollup-normalize-path-windows

Conversation

@andreas-karlsson

Copy link
Copy Markdown
Collaborator

Split out from #419, which is otherwise closed — this is the one change from it worth landing.

normalizePath() returns the result of relative() verbatim. On Windows that is backslash-separated, so the path.startsWith(prefix) checks in createExternalTest (where prefix is build/) never match, and local build/ imports get misreported as unbundleable external dependencies:

Error: Attempt to bundle external dependency build\Confidence.js for import ./Confidence.js.
Are we missing a dependency?

Normalizing to forward slashes makes the prefix checks work on both platforms. No behavior change on POSIX, where relative() already returns forward slashes.

Credit to @vihaan-vijay, who found this while working on #419; retained as co-author on the commit.

Verification

yarn bundle passes locally (macOS). The Windows path is not exercised by CI — this is a fix for local development on Windows.

🤖 Generated with Claude Code

`relative()` returns backslash-separated paths on Windows, so the
`path.startsWith(prefix)` checks in `createExternalTest` never matched and
local `build/` imports were misreported as unbundleable external deps.

Co-authored-by: vihaan-vijay <mavijay898@gmail.com>
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@vihaan-vijay

vihaan-vijay commented Aug 2, 2026

Copy link
Copy Markdown

Thanks @andreas-karlsson! I appreciate you extracting this fix and keeping the co-authorship credit. I tested yarn bundle locally on Windows and can confirm it builds cleanly without path errors now!

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.

2 participants