Skip to content

fix(vite): ensure leading slash in /@fs URLs for Windows#34810

Merged
danielroe merged 2 commits into
nuxt:mainfrom
Flo0806:fix/vite-css-fs-url-windows
Apr 15, 2026
Merged

fix(vite): ensure leading slash in /@fs URLs for Windows#34810
danielroe merged 2 commits into
nuxt:mainfrom
Flo0806:fix/vite-css-fs-url-windows

Conversation

@Flo0806
Copy link
Copy Markdown
Member

@Flo0806 Flo0806 commented Apr 14, 2026

🔗 Linked issue

Fixes: #34766

📚 Description

Because of the fix (from me.... 😒) #34303....

Instead of generating a valid path in getManifest such as:
/@fs/D:/project/.../style.css

Nuxt may emit:
/@fsD:/project/.../style.css

That malformed URL returns 404 in development. The fix is simple check if path isn't starting with "/", add one slash.

@Flo0806 Flo0806 requested a review from danielroe as a code owner April 14, 2026 06:43
@bolt-new-by-stackblitz
Copy link
Copy Markdown

Review PR in StackBlitz Codeflow Run & review this pull request in StackBlitz Codeflow.

@github-actions github-actions Bot added 5.x 🐛 bug Something isn't working as expected labels Apr 14, 2026
@pkg-pr-new
Copy link
Copy Markdown

pkg-pr-new Bot commented Apr 14, 2026

Open in StackBlitz

@nuxt/kit

npm i https://pkg.pr.new/@nuxt/kit@34810

@nuxt/nitro-server

npm i https://pkg.pr.new/@nuxt/nitro-server@34810

nuxt

npm i https://pkg.pr.new/nuxt@34810

@nuxt/rspack-builder

npm i https://pkg.pr.new/@nuxt/rspack-builder@34810

@nuxt/schema

npm i https://pkg.pr.new/@nuxt/schema@34810

@nuxt/vite-builder

npm i https://pkg.pr.new/@nuxt/vite-builder@34810

@nuxt/webpack-builder

npm i https://pkg.pr.new/@nuxt/webpack-builder@34810

commit: 4d96172

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Apr 14, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 1f457efb-db5a-4c05-b555-10db617de2d1

📥 Commits

Reviewing files that changed from the base of the PR and between 94cb8a2 and 4d96172.

📒 Files selected for processing (1)
  • packages/vite/src/plugins/vite-node.ts
✅ Files skipped from review due to trivial changes (1)
  • packages/vite/src/plugins/vite-node.ts

Walkthrough

The change updates CSS path construction in the getManifest function of the vite-node plugin. When adding globally configured CSS for resolved bare module specifiers, the code now normalises resolved to ensure exactly one leading / by using resolved.replace(/^(?!\/)/, '/') before concatenating with '/@fs'. This prevents malformed '/@fs' paths when resolved already begins with a slash.

🚥 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
Title check ✅ Passed The title clearly describes the main fix: ensuring leading slashes in /@fs URLs for Windows, which directly addresses the changeset's purpose.
Description check ✅ Passed The description is related to the changeset, explaining the bug context (malformed URLs on Windows), the issue being fixed, and the solution approach.
Linked Issues check ✅ Passed The code change directly implements the required fix from issue #34766: normalizing the path with a leading slash before concatenating with /@fs to prevent malformed URLs on Windows.
Out of Scope Changes check ✅ Passed The single line change in vite-node.ts is narrowly scoped to fixing the Windows path concatenation issue; no out-of-scope modifications are present.

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

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

@codspeed-hq
Copy link
Copy Markdown

codspeed-hq Bot commented Apr 14, 2026

Merging this PR will improve performance by 12.19%

⚡ 1 improved benchmark
✅ 19 untouched benchmarks
⏩ 3 skipped benchmarks1

Performance Changes

Benchmark BASE HEAD Efficiency
loadNuxt in the basic test fixture 489.5 ms 436.3 ms +12.19%

Comparing Flo0806:fix/vite-css-fs-url-windows (4d96172) with main (130f270)

Open in CodSpeed

Footnotes

  1. 3 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports.

@danielroe danielroe enabled auto-merge April 15, 2026 09:19
@danielroe danielroe added this pull request to the merge queue Apr 15, 2026
Merged via the queue into nuxt:main with commit 95e6b9f Apr 15, 2026
28 checks passed
@github-actions github-actions Bot mentioned this pull request Apr 15, 2026
4 tasks
danielroe added a commit that referenced this pull request Apr 18, 2026
Co-authored-by: Daniel Roe <daniel@roe.dev>
@github-actions github-actions Bot mentioned this pull request Apr 8, 2026
danielroe added a commit that referenced this pull request Apr 25, 2026
Co-authored-by: Daniel Roe <daniel@roe.dev>
@github-actions github-actions Bot mentioned this pull request Apr 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

5.x 🐛 bug Something isn't working as expected

Projects

None yet

Development

Successfully merging this pull request may close these issues.

bug(vite-builder): invalid @fs path concatenation on Windows (missing leading slash)

2 participants