Skip to content

fix(ipx): use the configured baseURL when prerendering static images - #2313

Open
chairulakmal wants to merge 1 commit into
nuxt:mainfrom
chairulakmal:fix/1394-ipx-prerender-base-url
Open

fix(ipx): use the configured baseURL when prerendering static images#2313
chairulakmal wants to merge 1 commit into
nuxt:mainfrom
chairulakmal:fix/1394-ipx-prerender-base-url

Conversation

@chairulakmal

@chairulakmal chairulakmal commented Aug 14, 2026

Copy link
Copy Markdown

🔗 Linked issue

resolves #1394

📚 Description

Prerendering skips every IPX image when you set a custom baseURL, because the filter in prerenderStaticImages hardcodes /_ipx/. I changed it to use the configured base URL and fall back to /_ipx, so nothing changes on the default. I also strip a trailing slash, since '/static-images/' would otherwise fail the same silent way.

I pass the base URL in from the three call sites, which all have it already, instead of reading it inside the util: the unit tests import src/runtime/utils/ too, and #imports does not resolve there. Also added a new test file, test/e2e/generate-base-url.test.ts, instead of editing the existing generate test, so the default path stays covered. It fails without the change.

The CI tests passed except the two aliyun e2e cases that time out for me locally because their host is unreachable from my network. This is the same as a clean main, so unlikely the result of my changes in this PR.

@pkg-pr-new

pkg-pr-new Bot commented Aug 14, 2026

Copy link
Copy Markdown

Open in StackBlitz

npm i https://pkg.pr.new/@nuxt/image@2313

commit: be9947a

@coderabbitai

coderabbitai Bot commented Aug 14, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 4a7e3198-bc99-461c-85e9-36ecd4ebc2aa

📥 Commits

Reviewing files that changed from the base of the PR and between 21b9573 and be9947a.

📒 Files selected for processing (5)
  • src/runtime/components/NuxtImg.vue
  • src/runtime/components/NuxtPicture.vue
  • src/runtime/image.ts
  • src/runtime/utils/prerender.ts
  • test/e2e/generate-base-url.test.ts

📝 Walkthrough

Walkthrough

The change passes the configured IPX runtime baseURL into static image prerendering from NuxtImg, NuxtPicture, and the image runtime. The prerender utility normalizes the URL and uses it to detect image paths instead of relying on /_ipx/. An end-to-end test verifies prerendering with /static-images.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Merge Risk: ⚪ Minimal · up to be994

This localized change uses the configured base URL for static image prerendering while preserving the default behavior, and no actionable merge-blocking risk remains after normal checks and review.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Linked Issues check ✅ Passed The changes satisfy issue #1394 by detecting IPX images with the configured baseURL while preserving the default /_ipx/ behavior.
Out of Scope Changes check ✅ Passed All implementation and test changes directly support the linked issue and stated prerendering objectives.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Title check ✅ Passed The title clearly and concisely describes using the configured IPX baseURL during static image prerendering.
Description check ✅ Passed The description directly explains the bug, implementation, fallback behavior, call-site updates, and end-to-end test coverage.
✨ 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.

@codecov-commenter

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 42.85714% with 4 lines in your changes missing coverage. Please review.
✅ Project coverage is 32.35%. Comparing base (ac483b4) to head (be9947a).
⚠️ Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
src/runtime/utils/prerender.ts 0.00% 1 Missing and 2 partials ⚠️
src/runtime/image.ts 0.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2313      +/-   ##
==========================================
- Coverage   32.61%   32.35%   -0.27%     
==========================================
  Files           7        7              
  Lines         371      374       +3     
  Branches      131      132       +1     
==========================================
  Hits          121      121              
- Misses        194      196       +2     
- Partials       56       57       +1     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@chairulakmal chairulakmal changed the title fix(ipx): use the configured baseURL when prerendering static img fix(ipx): use the configured baseURL when prerendering static images Aug 14, 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.

IPX Static Render Skipped with Custom BaseURL

2 participants