Skip to content

fix(nitro,nuxt,vite): dedupe and normalise global css links in dev - #35834

Merged
danielroe merged 1 commit into
mainfrom
fix/dedupe-css
Jul 25, 2026
Merged

danielroe merged 1 commit into
mainfrom
fix/dedupe-css

Conversation

@danielroe

Copy link
Copy Markdown
Member

🔗 Linked issue

resolves #35831

📚 Description

reported in #35831 - we were emitting the same css twice (once normalised with /@fs path, once without

@github-actions github-actions Bot added 5.x 🐛 bug Something isn't working as expected labels Jul 25, 2026
@pkg-pr-new

pkg-pr-new Bot commented Jul 25, 2026

Copy link
Copy Markdown

Open in StackBlitz

@nuxt/kit

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

@nuxt/nitro-server

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

nuxt

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

@nuxt/rspack-builder

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

@nuxt/schema

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

@nuxt/vite-builder

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

@nuxt/webpack-builder

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

commit: a882398

@coderabbitai

This comment has been minimized.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@test/basic.test.ts`:
- Around line 1550-1553: Strengthen the globally registered CSS test by
asserting the emitted link’s href contains the dev-server /@fs/ path, not just
that one global.css link exists. Reuse the matched link from the existing test
and, if practical, fetch the referenced URL to verify it resolves successfully.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 0452ef13-0dbe-4477-9ef1-f80415f6f3fd

📥 Commits

Reviewing files that changed from the base of the PR and between 99bf45c and a882398.

📒 Files selected for processing (5)
  • packages/nitro-server/src/vite.ts
  • packages/nuxt/src/core/nuxt.ts
  • packages/vite/src/plugins/vite-node.ts
  • packages/vite/src/utils/css.ts
  • test/basic.test.ts

Comment thread test/basic.test.ts
Comment on lines +1550 to +1553
it('should emit a single link for globally-registered css', async () => {
const html = await $fetch<string>('/')
const links = html.match(/<link[^>]+global\.css[^>]*>/g) || []
expect(links).toHaveLength(1)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win

Assert the dev-server URL as well as link count.

A single incorrect global.css link still passes this test. Assert that its href uses /@fs/ (and, if practical, fetch it) to cover the 404/path-normalisation regression.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@test/basic.test.ts` around lines 1550 - 1553, Strengthen the globally
registered CSS test by asserting the emitted link’s href contains the dev-server
/@fs/ path, not just that one global.css link exists. Reuse the matched link
from the existing test and, if practical, fetch the referenced URL to verify it
resolves successfully.

@codspeed

codspeed Bot commented Jul 25, 2026

Copy link
Copy Markdown

Merging this PR will not alter performance

✅ 21 untouched benchmarks
⏩ 3 skipped benchmarks1


Comparing fix/dedupe-css (a882398) with main (99bf45c)

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. ↩

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.

Dev server fails to resolve local css: entry — 404 + inconsistent @fs/ path in emitted <link> tags (regression from 4.4.8)

1 participant