Skip to content

feat(kit): add updateAppConfig util for module authors#35651

Merged
danielroe merged 6 commits into
nuxt:mainfrom
luc122c:feat/updateAppConfig
Jul 18, 2026
Merged

feat(kit): add updateAppConfig util for module authors#35651
danielroe merged 6 commits into
nuxt:mainfrom
luc122c:feat/updateAppConfig

Conversation

@luc122c

@luc122c luc122c commented Jul 18, 2026

Copy link
Copy Markdown
Contributor

🔗 Linked issue

Resolves #27857

📚 Description

Introduces a new updateAppConfig util to @nuxt/kit which works similary to the existing updateRuntimeConfig util.

I've also re-numbered the docs to keep the two updateXConfig utils together.

Comment thread packages/kit/src/app-config.ts Outdated
Comment thread packages/kit/src/app-config.ts
@luc122c
luc122c marked this pull request as ready for review July 18, 2026 16:11
@luc122c
luc122c requested a review from danielroe as a code owner July 18, 2026 16:11
@github-actions github-actions Bot added 5.x ✨ enhancement New feature or improvement to existing functionality labels Jul 18, 2026
@coderabbitai

coderabbitai Bot commented Jul 18, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: f4ee66ec-0dbe-4cc8-817c-aa82341c40e5

📥 Commits

Reviewing files that changed from the base of the PR and between 489968d and 540df9f.

📒 Files selected for processing (1)
  • packages/kit/src/app-config.ts
🚧 Files skipped from review as they are similar to previous changes (1)
  • packages/kit/src/app-config.ts

Walkthrough

Adds and exports the Nuxt Kit updateAppConfig helper, documents its merge behaviour, and tests nested merges, overwrites, and key preservation. It also adds Nuxt Kit documentation pages covering Nitro utilities, path resolution, logging, builder APIs, Vite configuration access, and layer directories.

Possibly related PRs

  • nuxt/nuxt#35576 — Documents related Nuxt Kit builder APIs, including setBuildOutput.
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely summarises the new updateAppConfig utility for kit users.
Description check ✅ Passed The description matches the change set and explains the new utility plus the docs renumbering.
Linked Issues check ✅ Passed The PR adds the missing Kit-side updateAppConfig helper, matching the DX alignment goal in #27857.
Out of Scope Changes check ✅ Passed The docs additions and renumbering are covered by the PR objectives, and no unrelated changes stand out.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
✨ 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.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 14

🧹 Nitpick comments (1)
packages/kit/src/app-config.ts (1)

8-8: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Use AppConfigInput for updateAppConfig. Record<string, unknown> drops IntelliSense for standard app config keys; switch to AppConfigInput from @nuxt/schema and update docs/4.api/5.kit/11.app-config.md to match.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@packages/kit/src/app-config.ts` at line 8, Update the updateAppConfig
function parameter from Record<string, unknown> to AppConfigInput imported from
`@nuxt/schema`, preserving its existing behavior while restoring IntelliSense for
standard app configuration keys. Update the corresponding updateAppConfig
signature in 11.app-config.md to use AppConfigInput as well.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@docs/4.api/5.kit/12.nitro.md`:
- Around line 176-181: Update the useNitro example in the defineNuxtModule setup
to remove the unused createResolver call and its resolver variable, unless the
resolver is imported and meaningfully used; ensure the example is self-contained
and copyable.
- Around line 372-383: Update the documented signatures for both
addServerImportsDir and addServerScanDir so opts is optional, matching the
implementation’s default empty options object; omit the parameter only where the
implementation does not use it.
- Around line 202-204: Update the plugin documentation warning in the
`12.nitro.md` example to replace the empty import specifier with `nitro` for
`definePlugin`, matching the established import source used by the example
below.
- Around line 330-338: Update the documented addServerImports function signature
to name its parameter imports instead of dirs, matching the implementation and
the Parameters description; leave the type and return value unchanged.

In `@docs/4.api/5.kit/13.resolving.md`:
- Around line 187-194: Update the Return Value table’s resolve property
documentation to use the variadic signature accepted by
createResolver().resolve, showing multiple string path segments rather than a
single path argument. Leave resolvePath unchanged.
- Around line 30-48: Update the resolvePath and findPath option documentation in
13.resolving.md to include the resolver selector options: document options.type
and its pathType values, stating that pathType defaults to 'file' and also
supports 'dir'. Add the missing findPath directory-resolution API details and
correct any existing default-behavior descriptions without changing unrelated
options.

In `@docs/4.api/5.kit/15.builder.md`:
- Line 11: Update the introductory sentence in the builder documentation to use
“Nuxt has builders” instead of “Nuxt have builders,” leaving the remaining
explanation unchanged.
- Around line 315-317: Update the pluginFactory parameter documentation to
describe it as an object with optional vite, webpack, and rspack callbacks,
rather than as a factory function. Clarify that each callback returns the
corresponding plugin instance or supported array of instances.
- Around line 15-19: Update the deprecation warning in the extendViteConfig
documentation to apply only when using the server/client options for
environment-specific configuration. Keep extendViteConfig documented as the
general Vite configuration hook, while retaining the recommendation to use a
Vite config plugin or applyToEnvironment for scoped configuration.
- Around line 78-84: Update the extendViteConfig type example to show that its
callback may return Thenable<void>, and revise the affected plugin signature
examples to represent async plugin factories. Keep the existing ViteConfig,
ExtendViteConfigOptions, and synchronous forms where they remain supported.
- Around line 96-102: Remove the `prepend` option row from the
`extendViteConfig` and `extendWebpackConfig` option tables. Keep `prepend`
documented only for the plugin-registration helpers `addVitePlugin`,
`addWebpackPlugin`, and `addBuildPlugin`, where ordering behavior is supported.

In `@docs/4.api/5.kit/16.examples.md`:
- Around line 23-34: Clarify in the example around loadNuxt and the vite:extend
hook that overrides: { ssr: false } loads only the client-side build
configuration. Keep the override if client-only inspection is intended, and
explicitly state that the result does not represent the full SSR-enabled project
configuration.

In `@docs/4.api/5.kit/17.layers.md`:
- Line 125: Update the layer label in the logging expression near
getLayerDirectories so only the user layer is identified as user; do not infer
that every non-user index is base. Use a neutral layer label or derive the
actual layer type from available metadata, while preserving the existing
component count output.

In `@packages/kit/test/app-config.test.ts`:
- Around line 13-39: Ensure Nuxt cleanup runs even when assertions fail: in
packages/kit/test/app-config.test.ts ranges 13-39, 41-58, and 60-78, wrap each
test’s updateAppConfig and expect logic in try blocks and move the corresponding
await nuxt.close() calls into finally blocks.

---

Nitpick comments:
In `@packages/kit/src/app-config.ts`:
- Line 8: Update the updateAppConfig function parameter from Record<string,
unknown> to AppConfigInput imported from `@nuxt/schema`, preserving its existing
behavior while restoring IntelliSense for standard app configuration keys.
Update the corresponding updateAppConfig signature in 11.app-config.md to use
AppConfigInput as well.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: a148f1e8-398f-4766-9a31-c518fc71dc87

📥 Commits

Reviewing files that changed from the base of the PR and between 49c2fad and ebbba46.

📒 Files selected for processing (10)
  • docs/4.api/5.kit/11.app-config.md
  • docs/4.api/5.kit/12.nitro.md
  • docs/4.api/5.kit/13.resolving.md
  • docs/4.api/5.kit/14.logging.md
  • docs/4.api/5.kit/15.builder.md
  • docs/4.api/5.kit/16.examples.md
  • docs/4.api/5.kit/17.layers.md
  • packages/kit/src/app-config.ts
  • packages/kit/src/index.ts
  • packages/kit/test/app-config.test.ts

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Caution

Inline review comments failed to post. This is likely due to GitHub's internal server error or limits when posting large numbers of comments. If you are seeing this consistently it is likely a permissions issue. Please check "Moderation" -> "Code review limits" under your organization settings.

Actionable comments posted: 14

🧹 Nitpick comments (1)
packages/kit/src/app-config.ts (1)

8-8: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Use AppConfigInput for updateAppConfig. Record<string, unknown> drops IntelliSense for standard app config keys; switch to AppConfigInput from @nuxt/schema and update docs/4.api/5.kit/11.app-config.md to match.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@packages/kit/src/app-config.ts` at line 8, Update the updateAppConfig
function parameter from Record<string, unknown> to AppConfigInput imported from
`@nuxt/schema`, preserving its existing behavior while restoring IntelliSense for
standard app configuration keys. Update the corresponding updateAppConfig
signature in 11.app-config.md to use AppConfigInput as well.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@docs/4.api/5.kit/12.nitro.md`:
- Around line 176-181: Update the useNitro example in the defineNuxtModule setup
to remove the unused createResolver call and its resolver variable, unless the
resolver is imported and meaningfully used; ensure the example is self-contained
and copyable.
- Around line 372-383: Update the documented signatures for both
addServerImportsDir and addServerScanDir so opts is optional, matching the
implementation’s default empty options object; omit the parameter only where the
implementation does not use it.
- Around line 202-204: Update the plugin documentation warning in the
`12.nitro.md` example to replace the empty import specifier with `nitro` for
`definePlugin`, matching the established import source used by the example
below.
- Around line 330-338: Update the documented addServerImports function signature
to name its parameter imports instead of dirs, matching the implementation and
the Parameters description; leave the type and return value unchanged.

In `@docs/4.api/5.kit/13.resolving.md`:
- Around line 187-194: Update the Return Value table’s resolve property
documentation to use the variadic signature accepted by
createResolver().resolve, showing multiple string path segments rather than a
single path argument. Leave resolvePath unchanged.
- Around line 30-48: Update the resolvePath and findPath option documentation in
13.resolving.md to include the resolver selector options: document options.type
and its pathType values, stating that pathType defaults to 'file' and also
supports 'dir'. Add the missing findPath directory-resolution API details and
correct any existing default-behavior descriptions without changing unrelated
options.

In `@docs/4.api/5.kit/15.builder.md`:
- Line 11: Update the introductory sentence in the builder documentation to use
“Nuxt has builders” instead of “Nuxt have builders,” leaving the remaining
explanation unchanged.
- Around line 315-317: Update the pluginFactory parameter documentation to
describe it as an object with optional vite, webpack, and rspack callbacks,
rather than as a factory function. Clarify that each callback returns the
corresponding plugin instance or supported array of instances.
- Around line 15-19: Update the deprecation warning in the extendViteConfig
documentation to apply only when using the server/client options for
environment-specific configuration. Keep extendViteConfig documented as the
general Vite configuration hook, while retaining the recommendation to use a
Vite config plugin or applyToEnvironment for scoped configuration.
- Around line 78-84: Update the extendViteConfig type example to show that its
callback may return Thenable<void>, and revise the affected plugin signature
examples to represent async plugin factories. Keep the existing ViteConfig,
ExtendViteConfigOptions, and synchronous forms where they remain supported.
- Around line 96-102: Remove the `prepend` option row from the
`extendViteConfig` and `extendWebpackConfig` option tables. Keep `prepend`
documented only for the plugin-registration helpers `addVitePlugin`,
`addWebpackPlugin`, and `addBuildPlugin`, where ordering behavior is supported.

In `@docs/4.api/5.kit/16.examples.md`:
- Around line 23-34: Clarify in the example around loadNuxt and the vite:extend
hook that overrides: { ssr: false } loads only the client-side build
configuration. Keep the override if client-only inspection is intended, and
explicitly state that the result does not represent the full SSR-enabled project
configuration.

In `@docs/4.api/5.kit/17.layers.md`:
- Line 125: Update the layer label in the logging expression near
getLayerDirectories so only the user layer is identified as user; do not infer
that every non-user index is base. Use a neutral layer label or derive the
actual layer type from available metadata, while preserving the existing
component count output.

In `@packages/kit/test/app-config.test.ts`:
- Around line 13-39: Ensure Nuxt cleanup runs even when assertions fail: in
packages/kit/test/app-config.test.ts ranges 13-39, 41-58, and 60-78, wrap each
test’s updateAppConfig and expect logic in try blocks and move the corresponding
await nuxt.close() calls into finally blocks.

---

Nitpick comments:
In `@packages/kit/src/app-config.ts`:
- Line 8: Update the updateAppConfig function parameter from Record<string,
unknown> to AppConfigInput imported from `@nuxt/schema`, preserving its existing
behavior while restoring IntelliSense for standard app configuration keys.
Update the corresponding updateAppConfig signature in 11.app-config.md to use
AppConfigInput as well.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: a148f1e8-398f-4766-9a31-c518fc71dc87

📥 Commits

Reviewing files that changed from the base of the PR and between 49c2fad and ebbba46.

📒 Files selected for processing (10)
  • docs/4.api/5.kit/11.app-config.md
  • docs/4.api/5.kit/12.nitro.md
  • docs/4.api/5.kit/13.resolving.md
  • docs/4.api/5.kit/14.logging.md
  • docs/4.api/5.kit/15.builder.md
  • docs/4.api/5.kit/16.examples.md
  • docs/4.api/5.kit/17.layers.md
  • packages/kit/src/app-config.ts
  • packages/kit/src/index.ts
  • packages/kit/test/app-config.test.ts
🛑 Comments failed to post (14)
docs/4.api/5.kit/12.nitro.md (4)

176-181: 🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

Fix the useNitro example.

createResolver is referenced but not imported, and the resulting resolver is unused. Remove those lines or import and use the resolver so the example is copyable.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@docs/4.api/5.kit/12.nitro.md` around lines 176 - 181, Update the useNitro
example in the defineNuxtModule setup to remove the unused createResolver call
and its resolver variable, unless the resolver is imported and meaningfully
used; ensure the example is self-contained and copyable.

202-204: 🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail

# Inspect the target file around the cited lines.
file="docs/4.api/5.kit/12.nitro.md"
wc -l "$file"
sed -n '180,230p' "$file"

# Look for the symbol and related import examples in the docs tree.
rg -n "definePlugin|useRuntimeConfig|import .*from ``|from 'nitro'|from \"nitro\"" docs -S

Repository: nuxt/nuxt

Length of output: 43238


Replace the empty import specifier with nitro. In docs/4.api/5.kit/12.nitro.md, definePlugin should be imported from 'nitro' here, matching the example below.

🧰 Tools
🪛 LanguageTool

[uncategorized] ~203-~203: Loose punctuation mark.
Context: ...o utilities such as useRuntimeConfig. :: ### Usage ```ts twoslash import { ad...

(UNLIKELY_OPENING_PUNCTUATION)

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@docs/4.api/5.kit/12.nitro.md` around lines 202 - 204, Update the plugin
documentation warning in the `12.nitro.md` example to replace the empty import
specifier with `nitro` for `definePlugin`, matching the established import
source used by the example below.

330-338: 🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail

# Locate the documentation snippet and the source signature it cites.
git ls-files 'docs/4.api/5.kit/12.nitro.md' 'packages/kit/src/nitro.ts'

echo '--- docs excerpt ---'
sed -n '320,345p' docs/4.api/5.kit/12.nitro.md

echo '--- source excerpt ---'
sed -n '1,220p' packages/kit/src/nitro.ts

Repository: nuxt/nuxt

Length of output: 5024


🏁 Script executed:

#!/bin/bash
set -euo pipefail

# Check whether the parameter name is referenced elsewhere in docs or source.
rg -n --hidden --no-ignore-vcs '\baddServerImports\b|\bdirs\b|\bimports\b' docs packages/kit/src/nitro.ts

Repository: nuxt/nuxt

Length of output: 29227


🏁 Script executed:

#!/bin/bash
set -euo pipefail

python3 - <<'PY'
from pathlib import Path
p = Path('packages/kit/src/nitro.ts')
if p.exists():
    text = p.read_text()
    idx = text.find('addServerImports')
    print(text[max(0, idx-200):idx+400] if idx != -1 else 'not found')
PY

Repository: nuxt/nuxt

Length of output: 748


🏁 Script executed:

#!/bin/bash
set -euo pipefail

# If the docs file references a generated API table, inspect surrounding headings too.
sed -n '300,360p' docs/4.api/5.kit/12.nitro.md

Repository: nuxt/nuxt

Length of output: 3255


Rename the addServerImports signature parameter to imports. In docs/4.api/5.kit/12.nitro.md:333, the signature should match the implementation and the parameter description below; dirs refers to the directory-scanning API instead.

🧰 Tools
🪛 LanguageTool

[uncategorized] ~338-~338: Loose punctuation mark.
Context: ...[]): void ``` ### Parameters imports: An object or an array of objects with t...

(UNLIKELY_OPENING_PUNCTUATION)

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@docs/4.api/5.kit/12.nitro.md` around lines 330 - 338, Update the documented
addServerImports function signature to name its parameter imports instead of
dirs, matching the implementation and the Parameters description; leave the type
and return value unchanged.

372-383: 🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo "== docs excerpt =="
sed -n '360,390p' docs/4.api/5.kit/12.nitro.md
echo
sed -n '446,475p' docs/4.api/5.kit/12.nitro.md

echo
echo "== source excerpt =="
sed -n '1,220p' packages/kit/src/nitro.ts

Repository: nuxt/nuxt

Length of output: 6197


Mark opts optional in both directory-helper signatures. The docs show opts as required in both addServerImportsDir and addServerScanDir, but the implementation defaults it to {}. Change the signatures to opts?: { prepend?: boolean } or omit the parameter where it is unused.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@docs/4.api/5.kit/12.nitro.md` around lines 372 - 383, Update the documented
signatures for both addServerImportsDir and addServerScanDir so opts is
optional, matching the implementation’s default empty options object; omit the
parameter only where the implementation does not use it.
docs/4.api/5.kit/13.resolving.md (2)

30-48: 🎯 Functional Correctness | 🟠 Major | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail

# Map the relevant files and inspect the doc section plus the resolver implementation.
printf '\n== Files ==\n'
git ls-files 'docs/4.api/5.kit/13.resolving.md' 'packages/kit/src/resolve.ts'

printf '\n== Doc file (around lines 1-220) ==\n'
sed -n '1,220p' docs/4.api/5.kit/13.resolving.md | cat -n

printf '\n== Resolver implementation outline ==\n'
ast-grep outline packages/kit/src/resolve.ts --view expanded

printf '\n== Resolver implementation (around likely relevant sections) ==\n'
sed -n '1,260p' packages/kit/src/resolve.ts | cat -n

Repository: nuxt/nuxt

Length of output: 20968


Document the missing resolver selector options. In docs/4.api/5.kit/13.resolving.md (resolvePath and findPath), add options.type and show that pathType defaults to 'file' and also accepts 'dir'. The current docs miss the directory-resolution API and misstate the default behaviour.

🧰 Tools
🪛 LanguageTool

[uncategorized] ~38-~38: Loose punctuation mark.
Context: ... ``` ### Parameters path: A path to resolve. `options`: Opti...

(UNLIKELY_OPENING_PUNCTUATION)


[uncategorized] ~40-~40: Loose punctuation mark.
Context: ...th**: A path to resolve. **options`**: Options to pass to the resolver. This o...

(UNLIKELY_OPENING_PUNCTUATION)


[grammar] ~48-~48: The word “fallback” is a noun. The verb is spelled with a white space.
Context: ... | false | Whether to fallback to the original path if the resolved pa...

(NOUN_VERB_CONFUSION)

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@docs/4.api/5.kit/13.resolving.md` around lines 30 - 48, Update the
resolvePath and findPath option documentation in 13.resolving.md to include the
resolver selector options: document options.type and its pathType values,
stating that pathType defaults to 'file' and also supports 'dir'. Add the
missing findPath directory-resolution API details and correct any existing
default-behavior descriptions without changing unrelated options.

187-194: 🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail

printf '\n## files\n'
git ls-files 'docs/4.api/5.kit/13.resolving.md' 'packages/kit/src/resolve.ts'

printf '\n## resolve.ts outline\n'
ast-grep outline packages/kit/src/resolve.ts --view expanded || true

printf '\n## docs excerpt\n'
sed -n '180,200p' docs/4.api/5.kit/13.resolving.md

printf '\n## resolve.ts excerpt\n'
sed -n '1,220p' packages/kit/src/resolve.ts

Repository: nuxt/nuxt

Length of output: 9283


Match the variadic resolve signature. createResolver().resolve accepts multiple path segments (resolve(...path: string[])), but the return-value table still documents a single path: string argument. Update it to match the actual API.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@docs/4.api/5.kit/13.resolving.md` around lines 187 - 194, Update the Return
Value table’s resolve property documentation to use the variadic signature
accepted by createResolver().resolve, showing multiple string path segments
rather than a single path argument. Leave resolvePath unchanged.
docs/4.api/5.kit/15.builder.md (5)

11-11: 📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win

Correct the page introduction grammar.

Use “Nuxt has builders” rather than “Nuxt have builders”.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@docs/4.api/5.kit/15.builder.md` at line 11, Update the introductory sentence
in the builder documentation to use “Nuxt has builders” instead of “Nuxt have
builders,” leaving the remaining explanation unchanged.

Source: Linters/SAST tools


15-19: 🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail

printf '\n## docs snippet\n'
sed -n '1,80p' docs/4.api/5.kit/15.builder.md

printf '\n## source matches\n'
rg -n "extendViteConfig|applyToEnvironment|deprecated|server|client" packages/kit/src/build.ts docs/4.api/5.kit/15.builder.md

Repository: nuxt/nuxt

Length of output: 11281


🏁 Script executed:

#!/bin/bash
set -euo pipefail

printf '\n## build.ts outline\n'
ast-grep outline packages/kit/src/build.ts --view expanded || true

printf '\n## relevant source excerpt\n'
nl -ba packages/kit/src/build.ts | sed -n '1,260p'

Repository: nuxt/nuxt

Length of output: 2252


🏁 Script executed:

#!/bin/bash
set -euo pipefail

sed -n '111,220p' packages/kit/src/build.ts | cat -n

Repository: nuxt/nuxt

Length of output: 4996


Scope the deprecation warning to the server/client options. extendViteConfig itself is still the general hook for Vite config; only the environment-specific usage is deprecated, so the docs should not mark the whole API as deprecated. docs/4.api/5.kit/15.builder.md:15-19

🧰 Tools
🪛 LanguageTool

[uncategorized] ~15-~15: Possible missing article found.
Context: ...onfig` Extends the Vite configuration. Callback function can be called multiple times, ...

(AI_HYDRA_LEO_MISSING_THE)


[uncategorized] ~16-~16: Loose punctuation mark.
Context: ...ying to both client and server builds. ::warning This hook is now deprecated, an...

(UNLIKELY_OPENING_PUNCTUATION)


[uncategorized] ~18-~18: Loose punctuation mark.
Context: ... — the applyToEnvironment hook. :: ### Usage ```ts twoslash import { de...

(UNLIKELY_OPENING_PUNCTUATION)

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@docs/4.api/5.kit/15.builder.md` around lines 15 - 19, Update the deprecation
warning in the extendViteConfig documentation to apply only when using the
server/client options for environment-specific configuration. Keep
extendViteConfig documented as the general Vite configuration hook, while
retaining the recommendation to use a Vite config plugin or applyToEnvironment
for scoped configuration.

78-84: 🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail

# Map the relevant files first
printf '\n== file list ==\n'
git ls-files 'docs/4.api/5.kit/15.builder.md' 'packages/kit/src/build.ts'

printf '\n== docs outline ==\n'
ast-grep outline docs/4.api/5.kit/15.builder.md --view expanded || true

printf '\n== source outline ==\n'
ast-grep outline packages/kit/src/build.ts --view expanded || true

printf '\n== docs excerpts ==\n'
sed -n '60,340p' docs/4.api/5.kit/15.builder.md

printf '\n== source excerpts ==\n'
sed -n '1,260p' packages/kit/src/build.ts

Repository: nuxt/nuxt

Length of output: 24249


🏁 Script executed:

#!/bin/bash
set -euo pipefail

sed -n '70,90p' docs/4.api/5.kit/15.builder.md
printf '\n---\n'
sed -n '1,220p' packages/kit/src/build.ts

Repository: nuxt/nuxt

Length of output: 8187


🌐 Web query:

Nuxt kit build.ts extendViteConfig thenable callback plugin getter async types raw.githubusercontent.com

💡 Result:

In Nuxt Kit, the utilities used to modify build configurations, such as addVitePlugin and extendViteConfig, have been updated to support asynchronous operations [1]. Core improvements in recent versions (specifically visible in packages/kit/src/build.ts) include: 1. Support for Thenable Values: The build APIs, including addVitePlugin, have been updated to accept and handle Thenable types [1]. This allows for async plugin getters, which are particularly useful for lazy-loading plugins via dynamic imports [2][1]. 2. Asynchronous Plugin Getters: When using addVitePlugin, the pluginOrGetter parameter now supports a function that returns a Promise (or is async), allowing the plugin to be loaded or constructed asynchronously [2][3]. Internally, the Kit utilities now await these getters before registering them [1][3]. 3. Implementation Pattern: Within the Nuxt Kit source code, the pattern used is typeof pluginOrGetter === 'function' ? await pluginOrGetter() : pluginOrGetter [3][4]. This ensures that if a factory function is provided, the library properly awaits its result before proceeding [1]. Important Deprecation Note: While extendViteConfig remains available in some versions, it is increasingly deprecated in favor of using standard Vite plugins [2][5]. For modern Nuxt development (especially Nuxt 5+), you should transition to using addVitePlugin, which offers better support for environment-specific configuration via hooks like applyToEnvironment or configEnvironment [6][7]. If you are inspecting the source code on GitHub (e.g., raw.githubusercontent.com), you will observe that these functions have evolved to include proper TypeScript support for Thenable and Arrayable types, ensuring that both synchronous plugin instances and asynchronous factories are handled robustly [1][3][4].

Citations:


🏁 Script executed:

#!/bin/bash
set -euo pipefail

# Show the other referenced type blocks with line numbers
nl -ba docs/4.api/5.kit/15.builder.md | sed -n '120,145p'
printf '\n---\n'
nl -ba docs/4.api/5.kit/15.builder.md | sed -n '190,215p'
printf '\n---\n'
nl -ba docs/4.api/5.kit/15.builder.md | sed -n '260,285p'
printf '\n---\n'
nl -ba docs/4.api/5.kit/15.builder.md | sed -n '295,325p'

Repository: nuxt/nuxt

Length of output: 187


🏁 Script executed:

#!/bin/bash
set -euo pipefail

nl -ba docs/4.api/5.kit/15.builder.md | sed -n '120,145p'
printf '\n---\n'
nl -ba docs/4.api/5.kit/15.builder.md | sed -n '190,215p'
printf '\n---\n'
nl -ba docs/4.api/5.kit/15.builder.md | sed -n '260,285p'
printf '\n---\n'
nl -ba docs/4.api/5.kit/15.builder.md | sed -n '295,325p'

Repository: nuxt/nuxt

Length of output: 187


🏁 Script executed:

#!/bin/bash
set -euo pipefail

awk 'NR>=120 && NR<=145 {printf "%5d  %s\n", NR, $0}' docs/4.api/5.kit/15.builder.md
printf '\n---\n'
awk 'NR>=190 && NR<=215 {printf "%5d  %s\n", NR, $0}' docs/4.api/5.kit/15.builder.md
printf '\n---\n'
awk 'NR>=260 && NR<=285 {printf "%5d  %s\n", NR, $0}' docs/4.api/5.kit/15.builder.md
printf '\n---\n'
awk 'NR>=295 && NR<=325 {printf "%5d  %s\n", NR, $0}' docs/4.api/5.kit/15.builder.md

Repository: nuxt/nuxt

Length of output: 5876


Show the async/thenable forms in the type examples. The type snippets in docs/4.api/5.kit/15.builder.md still show synchronous callback/plugin signatures, but the API accepts Thenable<void> and async plugin factories. Update the affected blocks to match the supported forms.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@docs/4.api/5.kit/15.builder.md` around lines 78 - 84, Update the
extendViteConfig type example to show that its callback may return
Thenable<void>, and revise the affected plugin signature examples to represent
async plugin factories. Keep the existing ViteConfig, ExtendViteConfigOptions,
and synchronous forms where they remain supported.

96-102: 🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo '--- docs/4.api/5.kit/15.builder.md (relevant ranges) ---'
sed -n '80,170p' docs/4.api/5.kit/15.builder.md

echo
echo '--- search for prepend in kit source/docs ---'
rg -n "prepend" packages/kit docs/4.api/5.kit/15.builder.md

echo
echo '--- packages/kit/src/build.ts (outline) ---'
ast-grep outline packages/kit/src/build.ts --view expanded

Repository: nuxt/nuxt

Length of output: 9891


🏁 Script executed:

#!/bin/bash
set -euo pipefail

# Focus on the build helpers and their option types.
rg -n -C 3 "prepend|extendViteConfig|extendWebpackConfig|addVitePlugin|addWebpackPlugin" packages/kit/src/build.ts docs/4.api/5.kit/15.builder.md

# Show only the relevant source slices if the file is not huge.
lines=$(wc -l < packages/kit/src/build.ts)
echo "build.ts lines: $lines"
if [ "$lines" -le 500 ]; then
  sed -n '1,260p' packages/kit/src/build.ts
else
  sed -n '1,220p' packages/kit/src/build.ts
  sed -n '220,420p' packages/kit/src/build.ts
fi

Repository: nuxt/nuxt

Length of output: 29747


Remove prepend from the extendViteConfig and extendWebpackConfig option tables. prepend only affects the plugin-registration helpers (addVitePlugin/addWebpackPlugin/addBuildPlugin); these config-extension callbacks ignore it, so the docs currently promise ordering behaviour they do not provide.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@docs/4.api/5.kit/15.builder.md` around lines 96 - 102, Remove the `prepend`
option row from the `extendViteConfig` and `extendWebpackConfig` option tables.
Keep `prepend` documented only for the plugin-registration helpers
`addVitePlugin`, `addWebpackPlugin`, and `addBuildPlugin`, where ordering
behavior is supported.

315-317: 🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail

printf '\n## build.ts references\n'
git ls-files | rg '^packages/kit/src/build\.ts$|^docs/4\.api/5\.kit/15\.builder\.md$'

printf '\n## ast-grep outline: packages/kit/src/build.ts\n'
ast-grep outline packages/kit/src/build.ts --view expanded || true

printf '\n## relevant doc lines\n'
sed -n '300,330p' docs/4.api/5.kit/15.builder.md | cat -n

printf '\n## relevant source lines\n'
sed -n '1,260p' packages/kit/src/build.ts | cat -n

Repository: nuxt/nuxt

Length of output: 14260


Describe pluginFactory as an object with optional vite, webpack, and rspack callbacks. The current text calls it a factory function and leaves out rspack.

🧰 Tools
🪛 LanguageTool

[uncategorized] ~317-~317: Loose punctuation mark.
Context: ...``` ### Parameters pluginFactory: A factory function that returns an obje...

(UNLIKELY_OPENING_PUNCTUATION)


[uncategorized] ~317-~317: Possible missing comma found.
Context: ...gin instance or an array of Vite plugin instances and/or a webpack plugin instance or an ...

(AI_HYDRA_LEO_MISSING_COMMA)

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@docs/4.api/5.kit/15.builder.md` around lines 315 - 317, Update the
pluginFactory parameter documentation to describe it as an object with optional
vite, webpack, and rspack callbacks, rather than as a factory function. Clarify
that each callback returns the corresponding plugin instance or supported array
of instances.
docs/4.api/5.kit/16.examples.md (1)

23-34: 🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo '--- docs/4.api/5.kit/16.examples.md (around lines 1-80) ---'
sed -n '1,80p' docs/4.api/5.kit/16.examples.md

echo
echo '--- search for loadNuxt / vite:extend / ssr false in docs ---'
rg -n "loadNuxt|vite:extend|overrides:\s*\{\s*ssr:\s*false\s*\}" docs -S

echo
echo '--- search repository-wide for overrides ssr false ---'
rg -n "overrides:\s*\{\s*ssr:\s*false\s*\}" -S .

Repository: nuxt/nuxt

Length of output: 5842


🏁 Script executed:

#!/bin/bash
set -euo pipefail
sed -n '1,80p' docs/4.api/5.kit/16.examples.md
rg -n "loadNuxt|vite:extend|overrides:\s*\{\s*ssr:\s*false\s*\}" docs -S
rg -n "overrides:\s*\{\s*ssr:\s*false\s*\}" -S .

Repository: nuxt/nuxt

Length of output: 5663


🌐 Web query:

Nuxt loadNuxt overrides ssr false vite:extend client-only configuration

💡 Result:

When using Nuxt programmatically with loadNuxt, you can override configuration options—including ssr: false—by passing an overrides object [1][2]. To effectively interact with the Vite configuration during this programmatic process, you should use the vite:extendConfig hook [3][4][5]. To override settings and extend Vite configuration programmatically: 1. Use loadNuxt from @nuxt/kit, providing an overrides object in the loadOptions to set ssr: false [1][2]. 2. Register a hook for vite:extendConfig on the returned Nuxt instance before building [4][5]. Example implementation: import { loadNuxt, buildNuxt } from '@nuxt/kit'; async function getViteConfig { // Load Nuxt with overrides const nuxt = await loadNuxt({ cwd: process.cwd, dev: false, overrides: { ssr: false } }); return new Promise((resolve, reject) => { // Extend or inspect Vite config nuxt.hook('vite:extendConfig', (config) => { // Modify config here resolve(config); throw new Error('stop'); // Stop build after config inspection }); buildNuxt(nuxt).catch((err) => { if (!err.toString.includes('stop')) reject(err); }); }).finally( => nuxt.close); } Regarding the ClientOnly component: It is a built-in Nuxt component used to defer rendering until the client-side has mounted [6]. When ssr: false is set globally, the entire application is treated as client-only, which makes the ClientOnly component behave differently (or redundantly) since the server-side rendering phase is effectively bypassed [7][8]. If you encounter issues where components are incorrectly detected as server components when ssr: false is active, ensure you are using a modern version of Nuxt, as this has been addressed in previous maintenance updates [9].

Citations:


🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo '--- docs/4.api/6.advanced/1.hooks.md around vite hooks ---'
sed -n '60,95p' docs/4.api/6.advanced/1.hooks.md

echo
echo '--- docs/4.api/5.kit/2.programmatic.md loadNuxt section ---'
sed -n '1,45p' docs/4.api/5.kit/2.programmatic.md

Repository: nuxt/nuxt

Length of output: 14492


Clarify that this only inspects the client-side Vite config. overrides: { ssr: false } changes which Nuxt build is loaded, so this example does not reflect the full SSR-enabled project config. Either remove the override or say explicitly that the lookup is client-only.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@docs/4.api/5.kit/16.examples.md` around lines 23 - 34, Clarify in the example
around loadNuxt and the vite:extend hook that overrides: { ssr: false } loads
only the client-side build configuration. Keep the override if client-only
inspection is intended, and explicitly state that the result does not represent
the full SSR-enabled project configuration.
docs/4.api/5.kit/17.layers.md (1)

125-125: 🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

Do not label every non-user layer as base.

getLayerDirectories() can include extended or intermediate layers, not only the user layer and base layers. Use a neutral label such as layer ${index}, or distinguish actual layer types from metadata rather than inferring them from the index.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@docs/4.api/5.kit/17.layers.md` at line 125, Update the layer label in the
logging expression near getLayerDirectories so only the user layer is identified
as user; do not infer that every non-user index is base. Use a neutral layer
label or derive the actual layer type from available metadata, while preserving
the existing component count output.
packages/kit/test/app-config.test.ts (1)

13-39: 🩺 Stability & Availability | 🟡 Minor | ⚡ Quick win

Ensure the Nuxt instance is always closed to prevent context leaks.

In all three tests, await nuxt.close() is called after the expect assertion. If an assertion fails, an error is thrown and the Nuxt instance is left open, which can leak the context into the next test and cause cascading failures. Wrap the test logic in a try...finally block to ensure cleanup always occurs.

  • packages/kit/test/app-config.test.ts#L13-L39: Wrap updateAppConfig and expect in a try block and move await nuxt.close() to the finally block.
  • packages/kit/test/app-config.test.ts#L41-L58: Apply the same try...finally pattern for cleanup.
  • packages/kit/test/app-config.test.ts#L60-L78: Apply the same try...finally pattern for cleanup.
📍 Affects 1 file
  • packages/kit/test/app-config.test.ts#L13-L39 (this comment)
  • packages/kit/test/app-config.test.ts#L41-L58
  • packages/kit/test/app-config.test.ts#L60-L78
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@packages/kit/test/app-config.test.ts` around lines 13 - 39, Ensure Nuxt
cleanup runs even when assertions fail: in packages/kit/test/app-config.test.ts
ranges 13-39, 41-58, and 60-78, wrap each test’s updateAppConfig and expect
logic in try blocks and move the corresponding await nuxt.close() calls into
finally blocks.

@danielroe
danielroe enabled auto-merge July 18, 2026 16:21
@danielroe danielroe changed the title feat(kit): updateAppConfig util feat(kit): add updateAppConfig util for module authors Jul 18, 2026
@codspeed-hq

codspeed-hq Bot commented Jul 18, 2026

Copy link
Copy Markdown

Merging this PR will not alter performance

✅ 21 untouched benchmarks
⏩ 3 skipped benchmarks1


Comparing luc122c:feat/updateAppConfig (489968d) with main (49c2fad)

Open in CodSpeed

Footnotes

  1. 3 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports.

@pkg-pr-new

pkg-pr-new Bot commented Jul 18, 2026

Copy link
Copy Markdown

Open in StackBlitz

@nuxt/kit

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

@nuxt/nitro-server

npm i https://pkg.pr.new/@nuxt/nitro-server@35651

nuxt

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

@nuxt/rspack-builder

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

@nuxt/schema

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

@nuxt/vite-builder

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

@nuxt/webpack-builder

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

commit: 489968d

@danielroe
danielroe added this pull request to the merge queue Jul 18, 2026
Merged via the queue into nuxt:main with commit 0fb77d6 Jul 18, 2026
4 checks passed
@luc122c
luc122c deleted the feat/updateAppConfig branch July 18, 2026 17:53
@github-actions github-actions Bot mentioned this pull request Jul 18, 2026
4 tasks
@github-actions github-actions Bot mentioned this pull request Jul 18, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

5.x ✨ enhancement New feature or improvement to existing functionality

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Align appConfig and runtimeConfig DX

2 participants