Skip to content

Conversation

@danielroe
Copy link
Member

🔗 Linked issue

resolves #33266

📚 Description

if cdnURL is set it isn't going to be a relative path so we can skip checking/relativising the app

@bolt-new-by-stackblitz
Copy link

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

@coderabbitai
Copy link

coderabbitai bot commented Sep 27, 2025

Walkthrough

In packages/nuxt/src/core/runtime/nitro/handlers/renderer.ts, the import of hasProtocol from 'ufo' was removed. The logic deciding whether to cache entryPath versus relativise it was updated: entryPath is now cached when ssrContext.runtimeConfig.app.cdnURL is truthy, in addition to the existing absolute/relative path consideration. This replaces the prior reliance on hasProtocol to determine caching behaviour.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Pre-merge checks and finishing touches

✅ Passed checks (5 passed)
Check name Status Explanation
Title Check ✅ Passed The title accurately reflects the core fix of preventing importmap relativisation when a CDN URL is configured, which matches the changes in the handler logic without extraneous details.
Linked Issues Check ✅ Passed The update adds a guard that skips importmap relativisation whenever app.cdnURL is configured, fulfilling the requirement to avoid a leading ./ for placeholder or non-http CDN URLs as described in issue #33266.
Out of Scope Changes Check ✅ Passed The only modifications are within the importmap rendering logic in renderer.ts to incorporate the cdnURL check, and no unrelated files or features were altered outside the scope of the linked issue.
Description Check ✅ Passed The description directly references the linked issue and clearly explains that setting cdnURL should bypass path relativisation, which aligns with the implemented change.
Docstring Coverage ✅ Passed No functions found in the changes. Docstring coverage check skipped.
✨ Finishing touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch fix/cdn-path

📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 7acb972 and caa58fc.

📒 Files selected for processing (1)
  • packages/nuxt/src/core/runtime/nitro/handlers/renderer.ts (2 hunks)
🧰 Additional context used
📓 Path-based instructions (1)
**/*.{ts,tsx}

📄 CodeRabbit inference engine (.github/copilot-instructions.md)

Follow standard TypeScript conventions and best practices

Files:

  • packages/nuxt/src/core/runtime/nitro/handlers/renderer.ts
🧠 Learnings (2)
📓 Common learnings
Learnt from: GalacticHypernova
PR: nuxt/nuxt#26468
File: packages/nuxt/src/components/plugins/loader.ts:24-24
Timestamp: 2024-11-05T15:22:54.759Z
Learning: In `packages/nuxt/src/components/plugins/loader.ts`, the references to `resolve` and `distDir` are legacy code from before Nuxt used the new unplugin VFS and will be removed.
Learnt from: huang-julien
PR: nuxt/nuxt#29366
File: packages/nuxt/src/app/components/nuxt-root.vue:16-19
Timestamp: 2024-12-12T12:36:34.871Z
Learning: In `packages/nuxt/src/app/components/nuxt-root.vue`, when optimizing bundle size by conditionally importing components based on route metadata, prefer using inline conditional imports like:

```js
const IsolatedPage = route?.meta?.isolate ? defineAsyncComponent(() => import('#build/isolated-page.mjs')) : null
```

instead of wrapping the import in a computed property or importing the component unconditionally.
📚 Learning: 2024-11-05T15:22:54.759Z
Learnt from: GalacticHypernova
PR: nuxt/nuxt#26468
File: packages/nuxt/src/components/plugins/loader.ts:24-24
Timestamp: 2024-11-05T15:22:54.759Z
Learning: In `packages/nuxt/src/components/plugins/loader.ts`, the references to `resolve` and `distDir` are legacy code from before Nuxt used the new unplugin VFS and will be removed.

Applied to files:

  • packages/nuxt/src/core/runtime/nitro/handlers/renderer.ts
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (20)
  • GitHub Check: test-fixtures (windows-latest, dev, vite, default, manifest-off, json, lts/-1)
  • GitHub Check: test-fixtures (windows-latest, built, vite, default, manifest-off, json, lts/-1)
  • GitHub Check: test-fixtures (windows-latest, built, vite, async, manifest-off, json, lts/-1)
  • GitHub Check: test-fixtures (windows-latest, dev, vite, async, manifest-off, json, lts/-1)
  • GitHub Check: test-fixtures (ubuntu-latest, built, webpack, default, manifest-on, json, lts/-1)
  • GitHub Check: test-fixtures (ubuntu-latest, built, vite, default, manifest-off, json, lts/-1)
  • GitHub Check: test-fixtures (ubuntu-latest, built, vite, default, manifest-on, json, lts/-1)
  • GitHub Check: test-fixtures (ubuntu-latest, built, webpack, async, manifest-on, json, lts/-1)
  • GitHub Check: test-fixtures (ubuntu-latest, dev, vite, async, manifest-on, js, lts/-1)
  • GitHub Check: test-fixtures (ubuntu-latest, dev, vite, default, manifest-off, json, lts/-1)
  • GitHub Check: test-fixtures (ubuntu-latest, dev, vite, async, manifest-off, json, lts/-1)
  • GitHub Check: test-fixtures (ubuntu-latest, built, vite, async, manifest-on, json, lts/-1)
  • GitHub Check: test-fixtures (ubuntu-latest, dev, vite, async, manifest-on, json, lts/-1)
  • GitHub Check: test-fixtures (ubuntu-latest, dev, vite, default, manifest-on, json, lts/-1)
  • GitHub Check: release-pkg-pr-new
  • GitHub Check: test-size
  • GitHub Check: test-benchmark
  • GitHub Check: typecheck (windows-latest, bundler)
  • GitHub Check: typecheck (ubuntu-latest, bundler)
  • GitHub Check: code

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.

@pkg-pr-new
Copy link

pkg-pr-new bot commented Sep 27, 2025

Open in StackBlitz

@nuxt/kit

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

nuxt

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

@nuxt/rspack-builder

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

@nuxt/schema

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

@nuxt/vite-builder

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

@nuxt/webpack-builder

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

commit: caa58fc

@codspeed-hq
Copy link

codspeed-hq bot commented Sep 27, 2025

CodSpeed Performance Report

Merging #33333 will not alter performance

Comparing fix/cdn-path (caa58fc) with main (3e4a999)1

Summary

✅ 10 untouched

Footnotes

  1. No successful run was found on main (2d63479) during the generation of this report, so 3e4a999 was used instead as the comparison base. There might be some changes unrelated to this pull request in this report.

@danielroe danielroe merged commit 910d159 into main Sep 27, 2025
188 of 195 checks passed
@danielroe danielroe deleted the fix/cdn-path branch September 27, 2025 11:33
@github-actions github-actions bot mentioned this pull request Sep 27, 2025
@github-actions github-actions bot mentioned this pull request Oct 6, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Incorrect ImportMap generation when cdnURL is not an http URL

2 participants