fix: strip Windows UNC path prefix for Bun compatibility#494
Merged
Conversation
On Windows, `std::fs::canonicalize()` and Tauri's `resource_dir()` return paths with the `\?\` extended-length path prefix. Node.js handles this transparently, but Bun does not — it treats the prefix as part of the filename, causing module resolution failures in the Extension Host. This caused ALL built-in extensions (git, emmet, json-language-features, typescript-language-features, etc.) to fail activation on Windows with errors like: `Cannot find module '\?\E:\...\extension.js'`. Fix: - Add `dunce` crate which provides `canonicalize()` without the UNC prefix - Replace `std::fs::canonicalize()` with `dunce::canonicalize()` in `resolve_extensions_dir()` (extensions.rs) - Add `strip_unc_prefix()` helper and apply it to `resource_dir()` and `current_dir()` results in `resolve_app_root_and_resource_dir()` (spawn_exthost.rs) On macOS/Linux, `dunce` is a thin wrapper around `std::fs` with no behavioral change. Co-Authored-By: Claude Opus 4.7 <[email protected]>
Co-Authored-By: Claude Opus 4.7 <[email protected]>
This was referenced May 9, 2026
Merged
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.
Summary
\?\UNCパスプレフィックスを処理できず、全ビルトイン拡張機能のアクティベーションが失敗していた問題を修正dunceクレートを追加し、canonicalize()がUNCプレフィックスなしのパスを返すように変更spawn_exthost.rsにstrip_unc_prefix()ヘルパーを追加し、resource_dir()とcurrent_dir()の結果もクリーンアップRoot cause
On Windows,
std::fs::canonicalize()and Tauri'sresource_dir()return paths with the\?\extended-length path prefix. Node.js handles this transparently, but Bun does not — it treats the prefix as part of the filename, causing all built-in extensions to fail withCannot find module '\?\E:\...\extension.js'.Test plan
🤖 Generated with Claude Code