Skip to content

Conversation

@KazariEX
Copy link
Member

@KazariEX KazariEX commented Oct 7, 2025

🔗 Linked issue

📚 Description

To avoid errors like #33410 from happening again, we need to ensure that the call to loadNuxtConfig is concurrency-safe.

@KazariEX KazariEX requested a review from danielroe as a code owner October 7, 2025 13:25
@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 Oct 7, 2025

Warning

Rate limit exceeded

@KazariEX has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait 22 minutes and 36 seconds before requesting another review.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

📥 Commits

Reviewing files that changed from the base of the PR and between 659ede4 and a897780.

📒 Files selected for processing (1)
  • packages/kit/src/loader/config.ts (2 hunks)

Walkthrough

Introduces a new internal helper, withDefineNuxtConfig, that scopes exposure of globalThis.defineNuxtConfig using a per-process reference counter. The previous pattern of assigning globalThis.defineNuxtConfig immediately before calling loadConfig and deleting it after is removed. loadConfig calls are now wrapped with withDefineNuxtConfig so the global is available for the duration of the scoped call and cleaned up when the last consumer finishes. No exported or public API signatures were changed.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (2 passed)
Check name Status Explanation
Title Check ✅ Passed The title succinctly captures the primary change by describing the safe assignment and cleanup of defineNuxtConfig for concurrent calls, directly reflecting the main update introduced in the code. It is clear, specific, and immediately conveys the intent of the fix.
Description Check ✅ Passed The description clearly relates to the changes by stating the goal of preventing errors like #33410 through making the loadNuxtConfig call concurrency-safe, which aligns with the code modifications.

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

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 5589a44 and a269d98.

📒 Files selected for processing (1)
  • packages/kit/src/loader/config.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/kit/src/loader/config.ts
🔇 Additional comments (1)
packages/kit/src/loader/config.ts (1)

36-48: LGTM!

The wrapping of loadConfig with withDefineNuxtConfig correctly preserves the original behaviour while adding the reference-counted lifecycle management for globalThis.defineNuxtConfig.

@pkg-pr-new
Copy link

pkg-pr-new bot commented Oct 7, 2025

Open in StackBlitz

@nuxt/kit

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

nuxt

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

@nuxt/rspack-builder

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

@nuxt/schema

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

@nuxt/vite-builder

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

@nuxt/webpack-builder

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

commit: a897780

@codspeed-hq
Copy link

codspeed-hq bot commented Oct 7, 2025

CodSpeed Performance Report

Merging #33420 will not alter performance

Comparing KazariEX:fix/define-nuxt-config-count (a897780) with main (5589a44)

Summary

✅ 10 untouched

@danielroe danielroe merged commit 94e6fbb into nuxt:main Oct 7, 2025
83 of 84 checks passed
@danielroe
Copy link
Member

thank you ❤️

@github-actions github-actions bot mentioned this pull request Oct 7, 2025
@KazariEX KazariEX deleted the fix/define-nuxt-config-count branch October 7, 2025 18:50
@github-actions github-actions bot mentioned this pull request Oct 7, 2025
@github-actions github-actions bot mentioned this pull request Oct 23, 2025
@github-actions github-actions bot mentioned this pull request Oct 25, 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.

2 participants