Skip to content

fix: properly handle Windows backslash paths in @fs imports#98

Closed
jackyjjp wants to merge 1 commit into
1weiho:mainfrom
jackyjjp:patch-1
Closed

fix: properly handle Windows backslash paths in @fs imports#98
jackyjjp wants to merge 1 commit into
1weiho:mainfrom
jackyjjp:patch-1

Conversation

@jackyjjp
Copy link
Copy Markdown

@jackyjjp jackyjjp commented May 11, 2026

On Windows, absolute file paths use backslashes (e.g. D:\project\slides\index.tsx). The current code only strips leading slashes for Unix paths but does not convert backslashes to forward slashes, which breaks Vite's /@fs/ protocol on Windows.

Before: /@fs/D:\project\slides\index.tsx (broken)
After: /@fs/D:/project/slides/index.tsx (correct)

This is a one-character fix: adding .replace(/\\/g, '/') after the existing .replace(/^\/+/, '') call.

Fixes the "Failed to resolve import /@FSD:/..." error on Windows systems.

Summary by CodeRabbit

  • Bug Fixes
    • Fixed path normalization in development mode to ensure consistent functionality across Windows, macOS, and Linux systems.

Review Change Stack

On Windows, absolute file paths use backslashes (e.g. `D:\project\slides\index.tsx`).
The current code only strips leading slashes for Unix paths but does not convert
backslashes to forward slashes, which breaks Vite's `/@fs/` protocol on Windows.

Before: `/@fs/D:\project\slides\index.tsx`  (broken)
After:  `/@fs/D:/project/slides/index.tsx`  (correct)

This is a one-character fix: adding `.replace(/\\/g, '/')` after the existing
`.replace(/^\/+/, '')` call.

Fixes the "Failed to resolve import /@FSD:/..." error on Windows systems.
@vercel
Copy link
Copy Markdown

vercel Bot commented May 11, 2026

@jackyjjp is attempting to deploy a commit to the Yiwei Ho Team on Vercel.

A member of the Team first needs to authorize it.

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 11, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 20f5f3e1-5970-4fa1-9b6c-842680d023be

📥 Commits

Reviewing files that changed from the base of the PR and between 3f959a6 and ee17286.

📒 Files selected for processing (1)
  • packages/core/src/vite/open-slide-plugin.ts

Walkthrough

The Vite plugin virtual module for virtual:open-slide/slides now normalizes dynamic import paths on Windows by converting backslashes to forward slashes during dev-mode module generation, ensuring platform-safe path handling in import() calls.

Changes

Platform Path Normalization

Layer / File(s) Summary
Dev-mode Import Path Normalization
packages/core/src/vite/open-slide-plugin.ts
generateSlidesModule now converts Windows backslashes (\) to forward slashes (/) in dev-mode importPath generation before embedding paths into import() calls, ensuring cross-platform compatibility.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~2 minutes

Poem

A rabbit bounds through paths so steep,
Where backslashes made imports weep,
But forward slashes smooth the way,
Cross Windows, Mac—hooray, hooray! 🐰✨

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'fix: properly handle Windows backslash paths in @fs imports' directly and specifically describes the main change: fixing Windows path handling in Vite imports by converting backslashes to forward slashes.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

Tip

💬 Introducing Slack Agent: The best way for teams to turn conversations into code.

Slack Agent is built on CodeRabbit's deep understanding of your code, so your team can collaborate across the entire SDLC without losing context.

  • Generate code and open pull requests
  • Plan features and break down work
  • Investigate incidents and troubleshoot customer tickets together
  • Automate recurring tasks and respond to alerts with triggers
  • Summarize progress and report instantly

Built for teams:

  • Shared memory across your entire org—no repeating context
  • Per-thread sandboxes to safely plan and execute work
  • Governance built-in—scoped access, auditability, and budget controls

One agent for your entire SDLC. Right inside Slack.

👉 Get started


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@1weiho
Copy link
Copy Markdown
Owner

1weiho commented May 13, 2026

Hi @jackyjjp 👋🏻
thanks for your contribution, but this issue was already fixed in #54

@1weiho 1weiho closed this May 24, 2026
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