Repository navigation
fix(nitro,nuxt,vite): dedupe and normalise global css links in dev - #35834
Conversation
@nuxt/kit
@nuxt/nitro-server
nuxt
@nuxt/rspack-builder
@nuxt/schema
@nuxt/vite-builder
@nuxt/webpack-builder
commit: |
This comment has been minimized.
This comment has been minimized.
There was a problem hiding this comment.
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
📒 Files selected for processing (5)
packages/nitro-server/src/vite.tspackages/nuxt/src/core/nuxt.tspackages/vite/src/plugins/vite-node.tspackages/vite/src/utils/css.tstest/basic.test.ts
| 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) |
There was a problem hiding this comment.
📐 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.
Merging this PR will not alter performance
Comparing Footnotes
|
🔗 Linked issue
resolves #35831
📚 Description
reported in #35831 - we were emitting the same css twice (once normalised with
/@fspath, once without