fix(ipx): merge user-defined runtimeConfig.ipx with defaults#2134
Conversation
runtimeConfig.ipxruntimeConfig.ipx
commit: |
Deploying nuxt-image with
|
| Latest commit: |
29dc125
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://769f2eba.nuxt-image.pages.dev |
| Branch Preview URL: | https://fix-ipx-runtime-config.nuxt-image.pages.dev |
📝 WalkthroughWalkthroughThe change modifies the ipx runtime configuration assignment in src/ipx.ts to use the Estimated code review effort🎯 1 (Trivial) | ⏱️ ~4 minutes 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches
🧪 Generate unit tests (beta)
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. Comment |
There was a problem hiding this comment.
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
src/ipx.ts (1)
62-65:⚠️ Potential issue | 🟠 MajorPrerenderer path still overwrites
_config.runtimeConfig.ipx— inconsistent with the fix on Line 49.
nitro.options._config.runtimeConfig.ipxis overwritten withdefu({ fs: { dir: moduleOptions.dirs } }, ipxOptions)without first merging any user-defined values already present in_config.runtimeConfig.ipx. A user who sets$production.runtimeConfig.ipx(or any non-dev environment override) in their Nuxt config would still have it silently discarded, even after this PR.The fix should include
nitro.options._config.runtimeConfig.ipxas the leading argument so user-provided prerenderer config values survive:🐛 Proposed fix for the prerenderer path
- nitro.options._config.runtimeConfig.ipx = defu({ fs: { dir: moduleOptions.dirs } }, ipxOptions) + nitro.options._config.runtimeConfig.ipx = defu(nitro.options._config.runtimeConfig.ipx, { fs: { dir: moduleOptions.dirs } }, ipxOptions)🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@src/ipx.ts` around lines 62 - 65, The prerenderer branch overwrites nitro.options._config.runtimeConfig.ipx instead of merging user-provided values; change the assignment to call defu with the existing nitro.options._config.runtimeConfig.ipx as the first (leading) argument so user runtimeConfig.ipx entries are preserved (i.e., defu(existingRuntimeIpX, { fs: { dir: moduleOptions.dirs } }, ipxOptions)); keep the ipxHandler push as-is (nitro.options._config.handlers!.push(ipxHandler)).
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Outside diff comments:
In `@src/ipx.ts`:
- Around line 62-65: The prerenderer branch overwrites
nitro.options._config.runtimeConfig.ipx instead of merging user-provided values;
change the assignment to call defu with the existing
nitro.options._config.runtimeConfig.ipx as the first (leading) argument so user
runtimeConfig.ipx entries are preserved (i.e., defu(existingRuntimeIpX, { fs: {
dir: moduleOptions.dirs } }, ipxOptions)); keep the ipxHandler push as-is
(nitro.options._config.handlers!.push(ipxHandler)).
runtimeConfig.ipxruntimeConfig.ipx with defaults
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #2134 +/- ##
=====================================
Coverage 6.83% 6.83%
=====================================
Files 80 80
Lines 3732 3732
Branches 142 142
=====================================
Hits 255 255
Misses 3427 3427
Partials 50 50 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
🔗 Linked issue
resolves #2089
📚 Description
Merges user-defined
runtimeConfig.ipxinstead of overriding it withipxOptions.