Skip to content

fix: override user-defined format/screens/densities module options#2138

Open
DamianGlowala wants to merge 4 commits intomainfrom
fix/module-options-overriding
Open

fix: override user-defined format/screens/densities module options#2138
DamianGlowala wants to merge 4 commits intomainfrom
fix/module-options-overriding

Conversation

@DamianGlowala
Copy link
Member

🔗 Linked issue

resolves #1874
resolves #2020

📚 Description

This moves non-empty arrays and objects from defaults of defineNuxtModule to setup block, so that they are not affected by default merging behaviour.

@cloudflare-workers-and-pages
Copy link

cloudflare-workers-and-pages bot commented Feb 25, 2026

Deploying nuxt-image with  Cloudflare Pages  Cloudflare Pages

Latest commit: dac3aef
Status: ✅  Deploy successful!
Preview URL: https://d28e7d62.nuxt-image.pages.dev
Branch Preview URL: https://fix-module-options-overridin.nuxt-image.pages.dev

View logs

@pkg-pr-new
Copy link

pkg-pr-new bot commented Feb 25, 2026

Open in StackBlitz

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

commit: dac3aef

@coderabbitai
Copy link

coderabbitai bot commented Feb 25, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 891d766 and dac3aef.

📒 Files selected for processing (1)
  • playground/nuxt.config.ts
🚧 Files skipped from review as they are similar to previous changes (1)
  • playground/nuxt.config.ts

📝 Walkthrough

Walkthrough

Defaults for array/object image options were moved from module-definition time to setup-time normalization. The explicit type assertion for domains was removed (domains: []). During setup, densities now defaults to [1, 2] when not provided, format is normalized to a deduplicated array with a default of ['webp'], and screens defaults to a Tailwind-like breakpoint map (sm, 750, md, lg, xl, 2xl) if absent. These defaults are ensured before further processing. No public API signatures were changed.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately summarizes the main change: moving array/object module options to the setup block to allow proper overriding of user-defined format, screens, and densities configuration.
Description check ✅ Passed The description clearly explains the fix by describing the relocation of non-empty arrays and objects from defaults to the setup block to address default merging behavior issues.
Linked Issues check ✅ Passed The pull request successfully addresses both linked issues (#1874, #2020) by moving array/object defaults to the setup block, allowing users to fully override format, screens, and densities options without unwanted merging.
Out of Scope Changes check ✅ Passed All code changes are directly related to the objectives: modifying module defaults for domains, densities, format, and screens, plus updating the playground configuration to demonstrate the new behavior.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
  • 📝 Generate docstrings (stacked PR)
  • 📝 Generate docstrings (commit on current branch)
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch fix/module-options-overriding

Tip

Try Coding Plans. Let us write the prompt for your AI agent so you can ship faster (with fewer bugs).
Share your feedback on Discord.


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.

Copy link

@coderabbitai coderabbitai bot left a comment

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 the current code and only fix it if needed.

Inline comments:
In `@playground/nuxt.config.ts`:
- Line 19: The formats array in playground/nuxt.config.ts currently contains
both 'jpg' and 'jpeg' which are aliases and can cause inconsistent provider
behavior; update the formats array (the format entry used by the image provider
config) to use a single canonical value (prefer 'jpeg') or explicitly
document/justify keeping both if testing aliases, and ensure the chosen value
works with your targeted providers (notably hygraph which only accepts 'jpg').

ℹ️ Review info

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 4cfca91 and 891d766.

📒 Files selected for processing (1)
  • playground/nuxt.config.ts

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

1 participant