Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings
/nuxtPublic

feat(schema): add global tsconfig options#33795

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Open
Subham-KRLX wants to merge11 commits intonuxt:main
base:main
Choose a base branch
Loading
fromSubham-KRLX:fix/easier-global-tsconfig-options

Conversation

@Subham-KRLX
Copy link

🔗 Linked issue

Closes#33678

📚 Description

Makes it easier to define global TypeScript configuration options without duplication.

Problem: Users must duplicate TS config across multiple files since moving to Project References.

Solution:

  • typescript.tsConfig now applies globally to all generated tsconfig files
  • Addedtypescript.appTsConfig andtypescript.serverTsConfig for context-specific overrides
  • Fully backward compatible

Example:

exportdefaultdefineNuxtConfig({typescript:{// Applies to ALL contexts (app, node, shared, server)tsConfig:{compilerOptions:{noUncheckedIndexedAccess:true,verbatimModuleSyntax:true}}}})

cernymatej reacted with heart emoji
- Add appTsConfig and serverTsConfig options- Make tsConfig apply globally to all generated tsconfig files- Add JSDoc documentationClosesnuxt#33678
@bolt-new-by-stackblitz
Copy link

Review PR in StackBlitz CodeflowRun & review this pull request inStackBlitz Codeflow.

@coderabbitai
Copy link

coderabbitaibot commentedDec 1, 2025
edited
Loading

Walkthrough

Adds two public TypeScript config properties —appTsConfig andserverTsConfig — and changes tsconfig composition so context-specific configs (app,node,shared) are merged withtsConfig as a base. Simplifies emittedcompilerOptions fornode andshared contexts to a minimal baseline (mainlynoEmit,types, andpaths).nitro-server now composes its TS config viadefu(...) merging multiple TypeScript config sources and the change includes minor non-functional formatting normalisations.

Possibly related PRs

  • PR 30665 — Introduces splitting of TypeScript configs for node/app/server and updates template tsconfig generation and merge precedence.
  • PR 32644 — Adjusts node TypeScript config include paths and merge behaviour overlapping the node/server include composition changes.
  • PR 33462 — Modifies Nitro server TypeScript config composition and related server-side configuration handling.

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check nameStatusExplanationResolution
Docstring Coverage⚠️ WarningDocstring 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 (4 passed)
Check nameStatusExplanation
Title check✅ PassedThe title 'feat(schema): add global tsconfig options' directly and clearly describes the main change: adding new global TypeScript configuration options to the schema.
Description check✅ PassedThe description clearly explains the problem, solution, and provides a practical example showing how the new global tsConfig feature addresses the duplication issue mentioned in the linked issue.
Linked Issues check✅ PassedThe PR implements the core feature from issue#33678 by adding typescript.tsConfig as a global configuration applied to all contexts, and introducing typescript.appTsConfig and typescript.serverTsConfig for context-specific overrides, matching the requested API shape.
Out of Scope Changes check✅ PassedAll changes align with the stated objectives: schema extensions for new config properties, template updates to merge appTsConfig and tsConfig globally, and nitro-server initialization updates to use the new merged configuration.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

Tip

✨ Issue Enrichment is now available for GitHub issues!

CodeRabbit can now help you manage issues more effectively:

  • Duplicate Detection — Identify similar or duplicate issues
  • Related Issues & PRs — Find relevant issues and PR's from your repository
  • Suggested Assignees — Find the best person to work on the issue
  • Implementation Planning — Generate detailed coding plans for engineers and agents
Disable automatic issue enrichment

To disable automatic issue enrichment, add the following to your.coderabbit.yaml:

issue_enrichment:auto_enrich:enabled:false

Thanks for usingCodeRabbit! 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

@coderabbitaicoderabbitaibot 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 between81356f8 andbb8518e.

📒 Files selected for processing (4)
  • packages/kit/src/template.ts (1 hunks)
  • packages/nitro-server/src/index.ts (3 hunks)
  • packages/schema/src/config/typescript.ts (1 hunks)
  • packages/schema/src/types/schema.ts (14 hunks)
🧰 Additional context used
📓 Path-based instructions (2)
**/*.{ts,tsx,vue}

📄 CodeRabbit inference engine (.github/copilot-instructions.md)

Follow standard TypeScript conventions and best practices

Files:

  • packages/nitro-server/src/index.ts
  • packages/kit/src/template.ts
  • packages/schema/src/config/typescript.ts
  • packages/schema/src/types/schema.ts
**/*.{ts,tsx,js,jsx,vue}

📄 CodeRabbit inference engine (.github/copilot-instructions.md)

**/*.{ts,tsx,js,jsx,vue}: Use clear, descriptive variable and function names
Add comments only to explain complex logic or non-obvious implementations
Keep functions focused and manageable (generally under 50 lines), and extract complex logic into separate domain-specific files
Remove code that is not used or needed
Use error handling patterns consistently

Files:

  • packages/nitro-server/src/index.ts
  • packages/kit/src/template.ts
  • packages/schema/src/config/typescript.ts
  • packages/schema/src/types/schema.ts
🧠 Learnings (7)
📓 Common learnings
Learnt from: CRRepo: nuxt/nuxt PR: 0File: .github/copilot-instructions.md:0-0Timestamp: 2025-11-25T11:42:16.132ZLearning: Applies to **/*.{ts,tsx,vue} : Follow standard TypeScript conventions and best practices
📚 Learning: 2024-11-05T15:22:54.759Z
Learnt from: GalacticHypernovaRepo: nuxt/nuxt PR: 26468File: packages/nuxt/src/components/plugins/loader.ts:24-24Timestamp: 2024-11-05T15:22:54.759ZLearning: In `packages/nuxt/src/components/plugins/loader.ts`, the references to `resolve` and `distDir` are legacy code from before Nuxt used the new unplugin VFS and will be removed.

Applied to files:

  • packages/nitro-server/src/index.ts
📚 Learning: 2025-11-25T11:42:16.132Z
Learnt from: CRRepo: nuxt/nuxt PR: 0File: .github/copilot-instructions.md:0-0Timestamp: 2025-11-25T11:42:16.132ZLearning: Applies to **/*.{ts,tsx,vue} : Follow standard TypeScript conventions and best practices

Applied to files:

  • packages/nitro-server/src/index.ts
  • packages/kit/src/template.ts
  • packages/schema/src/types/schema.ts
📚 Learning: 2024-11-28T21:22:40.496Z
Learnt from: GalacticHypernovaRepo: nuxt/nuxt PR: 29661File: packages/kit/src/template.ts:227-229Timestamp: 2024-11-28T21:22:40.496ZLearning: In `packages/kit/src/template.ts`, when updating the `EXTENSION_RE` regular expression for TypeScript configuration, avoid using patterns like `(\.\w+)+$` as they can result in catastrophic backtracking.

Applied to files:

  • packages/kit/src/template.ts
📚 Learning: 2025-11-25T11:42:16.132Z
Learnt from: CRRepo: nuxt/nuxt PR: 0File: .github/copilot-instructions.md:0-0Timestamp: 2025-11-25T11:42:16.132ZLearning: Applies to **/*.vue : Use `<script setup lang="ts">` and the composition API when creating Vue components

Applied to files:

  • packages/kit/src/template.ts
  • packages/schema/src/types/schema.ts
📚 Learning: 2025-11-25T11:42:16.132Z
Learnt from: CRRepo: nuxt/nuxt PR: 0File: .github/copilot-instructions.md:0-0Timestamp: 2025-11-25T11:42:16.132ZLearning: Applies to **/*.{ts,tsx,js,jsx,vue} : Remove code that is not used or needed

Applied to files:

  • packages/kit/src/template.ts
📚 Learning: 2024-12-12T12:36:34.871Z
Learnt from: huang-julienRepo: nuxt/nuxt PR: 29366File: packages/nuxt/src/app/components/nuxt-root.vue:16-19Timestamp: 2024-12-12T12:36:34.871ZLearning: In `packages/nuxt/src/app/components/nuxt-root.vue`, when optimizing bundle size by conditionally importing components based on route metadata, prefer using inline conditional imports like:```jsconst IsolatedPage = route?.meta?.isolate ? defineAsyncComponent(() => import('#build/isolated-page.mjs')) : null```instead of wrapping the import in a computed property or importing the component unconditionally.

Applied to files:

  • packages/schema/src/types/schema.ts
🧬 Code graph analysis (2)
packages/nitro-server/src/index.ts (1)
packages/nitro-server/src/utils.ts (1)
  • distDir (11-11)
packages/kit/src/template.ts (1)
test/fixtures/basic-types/nuxt.config.ts (1)
  • tsConfig (110-112)
🪛 GitHub Check: build
packages/nitro-server/src/index.ts

[failure] 204-204:
Type '(Omit<Partial, "include" | "exclude" | "compilerOptions"> & Omit<{ compilerOptions: { lib: string[]; skipLibCheck: boolean; }; include: string[]; exclude: string[]; }, "include" | ... 1 more ... | "compilerOptions"> & { ...; }) | (Omit<...> & ... 1 more ... & { ...; })' is not assignable to type 'Partial | { compilerOptions?: StripEnums | { [x: string]: any; allowImportingTsExtensions?: any; allowJs?: any; ... 106 more ...; useDefineForClassFields?: any; } | undefined; ... 6 more ...; references?: { ...; }[] | ... 1 more ... | undefined; } | undefined'.

⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: code
🔇 Additional comments (4)
packages/schema/src/config/typescript.ts (1)

51-52:LGTM!

The default empty object values for the newappTsConfig andserverTsConfig options are appropriate.

packages/schema/src/types/schema.ts (1)

1641-1685:Well-documented API surface.

The documentation clearly articulates thattsConfig applies globally to all generated TypeScript configuration files, withappTsConfig andserverTsConfig providing context-specific overrides. The examples and type definitions are clear and helpful.

Note: The implementation inpackages/kit/src/template.ts does not fully honour this contract fornodeTsConfig andsharedTsConfig (see review comment on that file).

packages/nitro-server/src/index.ts (2)

573-573:Minor formatting adjustment in empty catch blocks.

The addition of a space within the empty catch blocks (catch(() => { })) is a non-functional formatting change.

Also applies to: 731-731


204-230:No action required—defu properly maintains TypeScript type safety.

Thedefu function is designed with full TypeScript support, including a genericDefu utility type that correctly models merged configuration objects. The composition strategy prioritizes Nitro-specific, server-specific, then globaltsConfig settings, and the updatedinclude andexclude paths provide appropriate coverage of module runtime and layer-specific directories. No type incompatibility exists for this merging pattern.

Subham-KRLXand others added3 commitsDecember 1, 2025 14:05
Addresses review feedback to ensure global typescript.tsConfig applies to nodeTsConfig and sharedTsConfig
Resolves CI type check failure where compileOnSave was inferred as boolean | nullish
Copy link

@coderabbitaicoderabbitaibot 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: 0

🧹 Nitpick comments (1)
packages/nitro-server/src/index.ts (1)

9-9:TSConfig merge layering matches the new API; note array behaviour and consider tightening the typing

Thedefu order here gives the intended precedence ofnuxt.options.nitro.typescript.tsConfignuxt.options.typescript.serverTsConfignuxt.options.typescript.tsConfig → the local defaults, so Nitro-specific settings win over server-specific, which win over global, with your baselinecompilerOptions,include andexclude acting as fallbacks. One behavioural gotcha to be aware of is thatdefu does not deep-merge arrays, so if a user setsinclude/exclude in any of these configs they will completely replace the built-in globs (including the Nitro types/includes) rather than extend them; if that is not desired, you would need to concatenate those arrays manually instead of relying ondefu alone. The explicitas unknown as TSConfig cast is acceptable, but if you want to align more closely with TypeScript best practices you could optionally wrap this merge in a small helper returningTSConfig, or assert the default object withsatisfies TSConfig to avoid theunknown hop.

Also applies to: 204-231

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and betweenb91dccf and2a7131e.

📒 Files selected for processing (1)
  • packages/nitro-server/src/index.ts (4 hunks)
🧰 Additional context used
📓 Path-based instructions (2)
**/*.{ts,tsx,vue}

📄 CodeRabbit inference engine (.github/copilot-instructions.md)

Follow standard TypeScript conventions and best practices

Files:

  • packages/nitro-server/src/index.ts
**/*.{ts,tsx,js,jsx,vue}

📄 CodeRabbit inference engine (.github/copilot-instructions.md)

**/*.{ts,tsx,js,jsx,vue}: Use clear, descriptive variable and function names
Add comments only to explain complex logic or non-obvious implementations
Keep functions focused and manageable (generally under 50 lines), and extract complex logic into separate domain-specific files
Remove code that is not used or needed
Use error handling patterns consistently

Files:

  • packages/nitro-server/src/index.ts
🧠 Learnings (3)
📓 Common learnings
Learnt from: CRRepo: nuxt/nuxt PR: 0File: .github/copilot-instructions.md:0-0Timestamp: 2025-11-25T11:42:16.132ZLearning: Applies to **/*.{ts,tsx,vue} : Follow standard TypeScript conventions and best practices
📚 Learning: 2025-11-25T11:42:16.132Z
Learnt from: CRRepo: nuxt/nuxt PR: 0File: .github/copilot-instructions.md:0-0Timestamp: 2025-11-25T11:42:16.132ZLearning: Applies to **/*.{ts,tsx,vue} : Follow standard TypeScript conventions and best practices

Applied to files:

  • packages/nitro-server/src/index.ts
📚 Learning: 2024-11-05T15:22:54.759Z
Learnt from: GalacticHypernovaRepo: nuxt/nuxt PR: 26468File: packages/nuxt/src/components/plugins/loader.ts:24-24Timestamp: 2024-11-05T15:22:54.759ZLearning: In `packages/nuxt/src/components/plugins/loader.ts`, the references to `resolve` and `distDir` are legacy code from before Nuxt used the new unplugin VFS and will be removed.

Applied to files:

  • packages/nitro-server/src/index.ts
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: code
🔇 Additional comments (1)
packages/nitro-server/src/index.ts (1)

573-573:Empty-catch formatting normalisation keeps the existing best-effort behaviour

Changing.catch(() => {}) to.catch(() => { }) for the prerender cache removal anddist symlink creation is purely stylistic; the "ignore all errors in these non-critical cleanup paths" behaviour is preserved, which is reasonable here.

Also applies to: 731-731

sharedTsConfig:TSConfig

/**
* You can extend the generated `.nuxt/tsconfig.app.json` (and legacy `.nuxt/tsconfig.json`) using this option.
Copy link
Member

Choose a reason for hiding this comment

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

I think we can drop the mention

Suggested change
*Youcanextendthegenerated`.nuxt/tsconfig.app.json`(andlegacy`.nuxt/tsconfig.json`)usingthisoption.
*Youcanextendthegenerated`.nuxt/tsconfig.app.json` usingthisoption.

Subham-KRLX reacted with thumbs up emoji
/**
* You can extend the generated `.nuxt/tsconfig.app.json` (and legacy `.nuxt/tsconfig.json`) using this option.
*
* This allows app-specific TypeScript configuration that will be merged with the global `typescript.tsConfig`.
Copy link
Member

Choose a reason for hiding this comment

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

maybe we could make it clearer that the globaltypescript.tsConfig options will be overridden by these context-specific options (i.e., they have higher priority)

I'd put the mention in all thedescriptions (node, shared, app, server).

Subham-KRLX reacted with thumbs up emoji
@pkg-pr-new
Copy link

pkg-pr-newbot commentedDec 1, 2025
edited
Loading

Open in StackBlitz

@nuxt/kit

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

@nuxt/nitro-server

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

nuxt

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

@nuxt/rspack-builder

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

@nuxt/schema

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

@nuxt/vite-builder

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

@nuxt/webpack-builder

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

commit:5c80102

Copy link

@coderabbitaicoderabbitaibot 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: 2

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between2a7131e and8aa005e.

📒 Files selected for processing (2)
  • packages/nitro-server/src/index.ts (12 hunks)
  • packages/schema/src/types/schema.ts (13 hunks)
🧰 Additional context used
📓 Path-based instructions (2)
**/*.{ts,tsx,vue}

📄 CodeRabbit inference engine (.github/copilot-instructions.md)

Follow standard TypeScript conventions and best practices

Files:

  • packages/schema/src/types/schema.ts
  • packages/nitro-server/src/index.ts
**/*.{ts,tsx,js,jsx,vue}

📄 CodeRabbit inference engine (.github/copilot-instructions.md)

**/*.{ts,tsx,js,jsx,vue}: Use clear, descriptive variable and function names
Add comments only to explain complex logic or non-obvious implementations
Keep functions focused and manageable (generally under 50 lines), and extract complex logic into separate domain-specific files
Remove code that is not used or needed
Use error handling patterns consistently

Files:

  • packages/schema/src/types/schema.ts
  • packages/nitro-server/src/index.ts
🧠 Learnings (6)
📓 Common learnings
Learnt from: CRRepo: nuxt/nuxt PR: 0File: .github/copilot-instructions.md:0-0Timestamp: 2025-11-25T11:42:16.132ZLearning: Applies to **/*.{ts,tsx,vue} : Follow standard TypeScript conventions and best practices
📚 Learning: 2025-11-25T11:42:16.132Z
Learnt from: CRRepo: nuxt/nuxt PR: 0File: .github/copilot-instructions.md:0-0Timestamp: 2025-11-25T11:42:16.132ZLearning: Applies to **/*.{ts,tsx,js,jsx,vue} : Remove code that is not used or needed

Applied to files:

  • packages/schema/src/types/schema.ts
  • packages/nitro-server/src/index.ts
📚 Learning: 2024-12-12T12:36:34.871Z
Learnt from: huang-julienRepo: nuxt/nuxt PR: 29366File: packages/nuxt/src/app/components/nuxt-root.vue:16-19Timestamp: 2024-12-12T12:36:34.871ZLearning: In `packages/nuxt/src/app/components/nuxt-root.vue`, when optimizing bundle size by conditionally importing components based on route metadata, prefer using inline conditional imports like:```jsconst IsolatedPage = route?.meta?.isolate ? defineAsyncComponent(() => import('#build/isolated-page.mjs')) : null```instead of wrapping the import in a computed property or importing the component unconditionally.

Applied to files:

  • packages/schema/src/types/schema.ts
  • packages/nitro-server/src/index.ts
📚 Learning: 2025-11-25T11:42:16.132Z
Learnt from: CRRepo: nuxt/nuxt PR: 0File: .github/copilot-instructions.md:0-0Timestamp: 2025-11-25T11:42:16.132ZLearning: Applies to **/*.vue : Use `<script setup lang="ts">` and the composition API when creating Vue components

Applied to files:

  • packages/schema/src/types/schema.ts
📚 Learning: 2025-11-25T11:42:16.132Z
Learnt from: CRRepo: nuxt/nuxt PR: 0File: .github/copilot-instructions.md:0-0Timestamp: 2025-11-25T11:42:16.132ZLearning: Applies to **/*.{ts,tsx,vue} : Follow standard TypeScript conventions and best practices

Applied to files:

  • packages/schema/src/types/schema.ts
  • packages/nitro-server/src/index.ts
📚 Learning: 2024-11-05T15:22:54.759Z
Learnt from: GalacticHypernovaRepo: nuxt/nuxt PR: 26468File: packages/nuxt/src/components/plugins/loader.ts:24-24Timestamp: 2024-11-05T15:22:54.759ZLearning: In `packages/nuxt/src/components/plugins/loader.ts`, the references to `resolve` and `distDir` are legacy code from before Nuxt used the new unplugin VFS and will be removed.

Applied to files:

  • packages/nitro-server/src/index.ts
🧬 Code graph analysis (1)
packages/schema/src/types/schema.ts (1)
packages/schema/src/index.ts (1)
  • RouterConfigSerializable (12-12)
🪛 GitHub Actions: autofix.ci
packages/nitro-server/src/index.ts

[error] 9-9: ESLint: 'TSConfig' is defined but never used. (no-unused-vars)

🪛 GitHub Check: code
packages/nitro-server/src/index.ts

[failure] 9-9:
'TSConfig' is defined but never used

⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (20)
  • GitHub Check: test-fixtures (ubuntu-latest, dev, vite, async, manifest-on, json, lts/-1)
  • GitHub Check: test-fixtures (windows-latest, built, vite, async, manifest-off, json, lts/-1)
  • GitHub Check: test-fixtures (windows-latest, built, webpack, default, manifest-on, json, lts/-1)
  • GitHub Check: test-fixtures (windows-latest, built, rspack, async, manifest-on, json, lts/-1)
  • GitHub Check: test-fixtures (windows-latest, built, vite-env-api, default, manifest-on, json, lts/-1)
  • GitHub Check: test-fixtures (ubuntu-latest, built, vite, default, manifest-off, json, lts/-1)
  • GitHub Check: test-fixtures (windows-latest, built, vite-env-api, async, manifest-on, json, lts/-1)
  • GitHub Check: test-fixtures (windows-latest, dev, vite-env-api, default, manifest-on, json, lts/-1)
  • GitHub Check: test-fixtures (windows-latest, dev, vite, async, manifest-off, json, lts/-1)
  • GitHub Check: test-fixtures (ubuntu-latest, built, webpack, default, manifest-on, json, lts/-1)
  • GitHub Check: test-fixtures (ubuntu-latest, dev, vite, default, manifest-on, json, lts/-1)
  • GitHub Check: test-fixtures (ubuntu-latest, built, vite, default, manifest-on, json, lts/-1)
  • GitHub Check: test-fixtures (ubuntu-latest, dev, vite, async, manifest-off, json, lts/-1)
  • GitHub Check: test-fixtures (ubuntu-latest, built, vite, async, manifest-off, json, lts/-1)
  • GitHub Check: test-fixtures (ubuntu-latest, dev, vite, async, manifest-on, js, lts/-1)
  • GitHub Check: test-fixtures (ubuntu-latest, dev, vite-env-api, default, manifest-on, json, lts/-1)
  • GitHub Check: test-fixtures (ubuntu-latest, dev, vite-env-api, async, manifest-on, json, lts/-1)
  • GitHub Check: release-pkg-pr-new
  • GitHub Check: test-benchmark
  • GitHub Check: typecheck (windows-latest, bundler)
🔇 Additional comments (2)
packages/schema/src/types/schema.ts (1)

1608-1698:Global + context-specific TypeScript config surface looks consistent

Thetypescript.tsConfig docs plus the newappTsConfig /serverTsConfig (and updatednodeTsConfig /sharedTsConfig) clearly describe the global‑then‑override precedence and match how Nitro composestsconfig.server.json in this PR. I don’t see any type or naming issues here; the API shape should solve the duplication problem while remaining backwards compatible.

packages/nitro-server/src/index.ts (1)

200-231:NitrotsConfig merge order matches documented precedence

The defu merge fortypescript.tsConfig:

  • nuxt.options.nitro.typescript?.tsConfig
  • thennuxt.options.typescript?.serverTsConfig
  • then globalnuxt.options.typescript?.tsConfig
  • then the internal defaults (lib/skipLibCheck/include/exclude)

gives the intended precedence of nitro‑specific > server‑specific > global > defaults, which lines up with the schema comments fortsConfig andserverTsConfig. This should make the new global + per‑context TS config surface effective for Nitro as well.

@codspeed-hq
Copy link

codspeed-hqbot commentedDec 1, 2025
edited
Loading

CodSpeed Performance Report

Merging#33795 willimprove performances by 10.25%

ComparingSubham-KRLX:fix/easier-global-tsconfig-options (5c80102) withmain (c1b3590)1

Summary

⚡ 1 improvement
✅ 9 untouched

Benchmarks breakdown

BenchmarkBASEHEADChange
writeTypes in the basic-types fixture90.5 ms82.1 ms+10.25%

Footnotes

  1. No successful run was found onmain (672880b) during the generation of this report, soc1b3590 was used instead as the comparison base. There might be some changes unrelated to this pull request in this report.

- Remove unused TSConfig import from nitro-server- Fix transpile callback typing to include isModern and isLegacy
Copy link

@coderabbitaicoderabbitaibot 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: 0

🧹 Nitpick comments (2)
packages/schema/src/types/schema.ts (1)

1677-1689:Consider clarifying override priority in all context-specific tsConfig documentation.

The documentation forappTsConfig andserverTsConfig mentions they "will be merged with the globaltypescript.tsConfig (which it overrides)", but the phrasing could be clearer about precedence. Consider using more explicit language across all four context-specific configs (app, node, shared, server).

For consistency, you might update the phrasing to:

 /**  * You can extend the generated `.nuxt/tsconfig.app.json` using this option.  *- * This allows app-specific TypeScript configuration that will be merged with the global `typescript.tsConfig` (which it overrides).+ * This allows app-specific TypeScript configuration that will override the global `typescript.tsConfig` when merged.  */

Apply the same pattern tonodeTsConfig,sharedTsConfig, andserverTsConfig for consistency.

Based on past review comments suggesting clearer override documentation.

packages/nitro-server/src/index.ts (1)

204-230:Type casting could be avoided with explicit typing.

Theas any cast on line 230 bypasses TypeScript's type checking. While this may be necessary due to defu's return type, consider extracting the configuration object to a typed variable first.

You could refactor like this:

constbaseTsConfigOptions={compilerOptions:{lib:['esnext','webworker','dom.iterable'],skipLibCheck:true,},include:[join(nuxt.options.buildDir,'types/nitro-nuxt.d.ts'),    ...modules.flatMap((m)=>{constmoduleDir=relativeWithDot(nuxt.options.buildDir,m)return[join(moduleDir,'runtime/server'),join(moduleDir,'dist/runtime/server'),]}),    ...layerDirs.map(dirs=>relativeWithDot(nuxt.options.buildDir,join(dirs.server,'**/*'))),    ...layerDirs.map(dirs=>relativeWithDot(nuxt.options.buildDir,join(dirs.shared,'**/*.d.ts'))),],exclude:[    ...nuxt.options.modulesDir.map(m=>relativeWithDot(nuxt.options.buildDir,m)),relativeWithDot(nuxt.options.buildDir,resolve(nuxt.options.rootDir,'dist')),],}satisfiesPartial<TSConfig>typescript:{tsConfig:defu(nuxt.options.nitro.typescript?.tsConfig,nuxt.options.typescript?.serverTsConfig,nuxt.options.typescript?.tsConfig,baseTsConfigOptions,),}

However, this is a minor refactoring and the current implementation is functional.

As per coding guidelines, following TypeScript best practices.

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between8aa005e anda1a4d11.

📒 Files selected for processing (2)
  • packages/nitro-server/src/index.ts (11 hunks)
  • packages/schema/src/types/schema.ts (13 hunks)
🧰 Additional context used
📓 Path-based instructions (2)
**/*.{ts,tsx,vue}

📄 CodeRabbit inference engine (.github/copilot-instructions.md)

Follow standard TypeScript conventions and best practices

Files:

  • packages/schema/src/types/schema.ts
  • packages/nitro-server/src/index.ts
**/*.{ts,tsx,js,jsx,vue}

📄 CodeRabbit inference engine (.github/copilot-instructions.md)

**/*.{ts,tsx,js,jsx,vue}: Use clear, descriptive variable and function names
Add comments only to explain complex logic or non-obvious implementations
Keep functions focused and manageable (generally under 50 lines), and extract complex logic into separate domain-specific files
Remove code that is not used or needed
Use error handling patterns consistently

Files:

  • packages/schema/src/types/schema.ts
  • packages/nitro-server/src/index.ts
🧠 Learnings (6)
📓 Common learnings
Learnt from: CRRepo: nuxt/nuxt PR: 0File: .github/copilot-instructions.md:0-0Timestamp: 2025-11-25T11:42:16.132ZLearning: Applies to **/*.{ts,tsx,vue} : Follow standard TypeScript conventions and best practices
📚 Learning: 2025-11-25T11:42:16.132Z
Learnt from: CRRepo: nuxt/nuxt PR: 0File: .github/copilot-instructions.md:0-0Timestamp: 2025-11-25T11:42:16.132ZLearning: Applies to **/*.{ts,tsx,js,jsx,vue} : Remove code that is not used or needed

Applied to files:

  • packages/schema/src/types/schema.ts
  • packages/nitro-server/src/index.ts
📚 Learning: 2024-12-12T12:36:34.871Z
Learnt from: huang-julienRepo: nuxt/nuxt PR: 29366File: packages/nuxt/src/app/components/nuxt-root.vue:16-19Timestamp: 2024-12-12T12:36:34.871ZLearning: In `packages/nuxt/src/app/components/nuxt-root.vue`, when optimizing bundle size by conditionally importing components based on route metadata, prefer using inline conditional imports like:```jsconst IsolatedPage = route?.meta?.isolate ? defineAsyncComponent(() => import('#build/isolated-page.mjs')) : null```instead of wrapping the import in a computed property or importing the component unconditionally.

Applied to files:

  • packages/schema/src/types/schema.ts
  • packages/nitro-server/src/index.ts
📚 Learning: 2025-11-25T11:42:16.132Z
Learnt from: CRRepo: nuxt/nuxt PR: 0File: .github/copilot-instructions.md:0-0Timestamp: 2025-11-25T11:42:16.132ZLearning: Applies to **/*.vue : Use `<script setup lang="ts">` and the composition API when creating Vue components

Applied to files:

  • packages/schema/src/types/schema.ts
📚 Learning: 2025-11-25T11:42:16.132Z
Learnt from: CRRepo: nuxt/nuxt PR: 0File: .github/copilot-instructions.md:0-0Timestamp: 2025-11-25T11:42:16.132ZLearning: Applies to **/*.{ts,tsx,vue} : Follow standard TypeScript conventions and best practices

Applied to files:

  • packages/schema/src/types/schema.ts
  • packages/nitro-server/src/index.ts
📚 Learning: 2024-11-05T15:22:54.759Z
Learnt from: GalacticHypernovaRepo: nuxt/nuxt PR: 26468File: packages/nuxt/src/components/plugins/loader.ts:24-24Timestamp: 2024-11-05T15:22:54.759ZLearning: In `packages/nuxt/src/components/plugins/loader.ts`, the references to `resolve` and `distDir` are legacy code from before Nuxt used the new unplugin VFS and will be removed.

Applied to files:

  • packages/nitro-server/src/index.ts
🧬 Code graph analysis (2)
packages/schema/src/types/schema.ts (3)
packages/nitro-server/build.config.ts (1)
  • ctx (12-14)
packages/nuxt/build.config.ts (1)
  • ctx (25-27)
packages/schema/src/index.ts (1)
  • RouterConfigSerializable (12-12)
packages/nitro-server/src/index.ts (1)
packages/nitro-server/src/utils.ts (1)
  • distDir (11-11)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
  • GitHub Check: build
  • GitHub Check: code
🔇 Additional comments (1)
packages/nitro-server/src/index.ts (1)

204-230:LGTM! TSConfig composition correctly implements the feature.

The defu-based merge strategy correctly prioritises configuration sources:

  1. Nitro-specific (nuxt.options.nitro.typescript?.tsConfig) — highest priority
  2. Server-specific (nuxt.options.typescript?.serverTsConfig)
  3. Global (nuxt.options.typescript?.tsConfig)
  4. Base configuration — lowest priority

The include/exclude arrays properly gather paths from modules, layers, and directories. This aligns perfectly with the PR objectives to provide global tsConfig options with context-specific overrides.

Copy link

@coderabbitaicoderabbitaibot 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: 0

🧹 Nitpick comments (1)
packages/nitro-server/src/index.ts (1)

204-230:TypeScript configuration composition looks good; consider improving type safety.

The defu-based merge correctly prioritises nitro-specific over server-specific over global configuration, which aligns well with the PR objectives for hierarchical TypeScript configuration. The dynamic include/exclude path generation properly covers module runtime/server directories and layer patterns.

However, theas any cast on line 230 bypasses type safety. Consider using a more specific type assertion or refining the type definitions to avoid the cast.

If the cast is unavoidable due to defu's type inference limitations, consider adding a brief comment explaining why it's necessary.

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and betweena1a4d11 and66e21b9.

📒 Files selected for processing (1)
  • packages/nitro-server/src/index.ts (3 hunks)
🧰 Additional context used
📓 Path-based instructions (2)
**/*.{ts,tsx,vue}

📄 CodeRabbit inference engine (.github/copilot-instructions.md)

Follow standard TypeScript conventions and best practices

Files:

  • packages/nitro-server/src/index.ts
**/*.{ts,tsx,js,jsx,vue}

📄 CodeRabbit inference engine (.github/copilot-instructions.md)

**/*.{ts,tsx,js,jsx,vue}: Use clear, descriptive variable and function names
Add comments only to explain complex logic or non-obvious implementations
Keep functions focused and manageable (generally under 50 lines), and extract complex logic into separate domain-specific files
Remove code that is not used or needed
Use error handling patterns consistently

Files:

  • packages/nitro-server/src/index.ts
🧠 Learnings (4)
📓 Common learnings
Learnt from: CRRepo: nuxt/nuxt PR: 0File: .github/copilot-instructions.md:0-0Timestamp: 2025-11-25T11:42:16.132ZLearning: Applies to **/*.{ts,tsx,vue} : Follow standard TypeScript conventions and best practices
📚 Learning: 2025-11-25T11:42:16.132Z
Learnt from: CRRepo: nuxt/nuxt PR: 0File: .github/copilot-instructions.md:0-0Timestamp: 2025-11-25T11:42:16.132ZLearning: Applies to **/*.{ts,tsx,vue} : Follow standard TypeScript conventions and best practices

Applied to files:

  • packages/nitro-server/src/index.ts
📚 Learning: 2025-11-25T11:42:16.132Z
Learnt from: CRRepo: nuxt/nuxt PR: 0File: .github/copilot-instructions.md:0-0Timestamp: 2025-11-25T11:42:16.132ZLearning: Applies to **/*.{ts,tsx,js,jsx,vue} : Remove code that is not used or needed

Applied to files:

  • packages/nitro-server/src/index.ts
📚 Learning: 2024-11-05T15:22:54.759Z
Learnt from: GalacticHypernovaRepo: nuxt/nuxt PR: 26468File: packages/nuxt/src/components/plugins/loader.ts:24-24Timestamp: 2024-11-05T15:22:54.759ZLearning: In `packages/nuxt/src/components/plugins/loader.ts`, the references to `resolve` and `distDir` are legacy code from before Nuxt used the new unplugin VFS and will be removed.

Applied to files:

  • packages/nitro-server/src/index.ts
🧬 Code graph analysis (1)
packages/nitro-server/src/index.ts (1)
packages/nitro-server/src/utils.ts (1)
  • distDir (11-11)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
  • GitHub Check: build
  • GitHub Check: code

@Subham-KRLX
Copy link
Author

I have addressed all CodeRabbit feedback by removing the unused TSConfig import and fixing the transpile callback typing to include isModern and isLegacy Regarding the failing CI checks the typecheck failures in bundler mode appear to be pre-existing dependency issues unrelated to this PR—all errors originate from node_modules packages (Vite, Nitropack, optional dependencies) rather than the modified code The rspack test timeout also seems to be test flakiness Local typecheck passes successfully with all changes applied.

Copy link

@coderabbitaicoderabbitaibot 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: 0

🧹 Nitpick comments (1)
packages/nitro-server/src/index.ts (1)

200-231:Good merge precedence, but avoidas any ontsConfig if possible.

Thedefu(...) order (nitro override →serverTsConfig → globaltsConfig → defaults) matches the PR intent and should give the right override behaviour. The trailingas any (Line 230) drops type guarantees; consider typing the merge result explicitly (e.g.TSConfig orNitroConfig['typescript']['tsConfig']) so future edits don’t silently drift.

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between66e21b9 and5c80102.

📒 Files selected for processing (2)
  • packages/kit/src/template.ts (2 hunks)
  • packages/nitro-server/src/index.ts (3 hunks)
🧰 Additional context used
📓 Path-based instructions (2)
**/*.{ts,tsx,vue}

📄 CodeRabbit inference engine (.github/copilot-instructions.md)

Follow standard TypeScript conventions and best practices

Files:

  • packages/nitro-server/src/index.ts
  • packages/kit/src/template.ts
**/*.{ts,tsx,js,jsx,vue}

📄 CodeRabbit inference engine (.github/copilot-instructions.md)

**/*.{ts,tsx,js,jsx,vue}: Use clear, descriptive variable and function names
Add comments only to explain complex logic or non-obvious implementations
Keep functions focused and manageable (generally under 50 lines), and extract complex logic into separate domain-specific files
Remove code that is not used or needed
Use error handling patterns consistently

Files:

  • packages/nitro-server/src/index.ts
  • packages/kit/src/template.ts
🧠 Learnings (11)
📓 Common learnings
Learnt from: CRRepo: nuxt/nuxt PR: 0File: .github/copilot-instructions.md:0-0Timestamp: 2025-11-25T11:42:16.132ZLearning: Applies to **/*.{ts,tsx,vue} : Follow standard TypeScript conventions and best practices
📚 Learning: 2025-11-25T11:42:16.132Z
Learnt from: CRRepo: nuxt/nuxt PR: 0File: .github/copilot-instructions.md:0-0Timestamp: 2025-11-25T11:42:16.132ZLearning: Applies to **/*.{ts,tsx,js,jsx,vue} : Remove code that is not used or needed

Applied to files:

  • packages/nitro-server/src/index.ts
  • packages/kit/src/template.ts
📚 Learning: 2025-11-25T11:42:16.132Z
Learnt from: CRRepo: nuxt/nuxt PR: 0File: .github/copilot-instructions.md:0-0Timestamp: 2025-11-25T11:42:16.132ZLearning: Applies to **/*.{ts,tsx,vue} : Follow standard TypeScript conventions and best practices

Applied to files:

  • packages/nitro-server/src/index.ts
  • packages/kit/src/template.ts
📚 Learning: 2024-11-05T15:22:54.759Z
Learnt from: GalacticHypernovaRepo: nuxt/nuxt PR: 26468File: packages/nuxt/src/components/plugins/loader.ts:24-24Timestamp: 2024-11-05T15:22:54.759ZLearning: In `packages/nuxt/src/components/plugins/loader.ts`, the references to `resolve` and `distDir` are legacy code from before Nuxt used the new unplugin VFS and will be removed.

Applied to files:

  • packages/nitro-server/src/index.ts
📚 Learning: 2024-11-28T21:22:40.496Z
Learnt from: GalacticHypernovaRepo: nuxt/nuxt PR: 29661File: packages/kit/src/template.ts:227-229Timestamp: 2024-11-28T21:22:40.496ZLearning: In `packages/kit/src/template.ts`, when updating the `EXTENSION_RE` regular expression for TypeScript configuration, avoid using patterns like `(\.\w+)+$` as they can result in catastrophic backtracking.

Applied to files:

  • packages/kit/src/template.ts
📚 Learning: 2024-11-11T12:34:22.648Z
Learnt from: TofandelRepo: nuxt/nuxt PR: 0File: :0-0Timestamp: 2024-11-11T12:34:22.648ZLearning: Ensure that AI-generated summaries accurately reflect the key changes in the PR, focusing on notable changes such as the removal of unused imports and variables starting with underscores.

Applied to files:

  • packages/kit/src/template.ts
📚 Learning: 2025-11-25T11:42:16.132Z
Learnt from: CRRepo: nuxt/nuxt PR: 0File: .github/copilot-instructions.md:0-0Timestamp: 2025-11-25T11:42:16.132ZLearning: Applies to **/*.{ts,tsx,js,jsx,vue} : Use error handling patterns consistently

Applied to files:

  • packages/kit/src/template.ts
📚 Learning: 2025-11-25T11:42:16.132Z
Learnt from: CRRepo: nuxt/nuxt PR: 0File: .github/copilot-instructions.md:0-0Timestamp: 2025-11-25T11:42:16.132ZLearning: Applies to **/*.{ts,tsx,js,jsx,vue} : Keep functions focused and manageable (generally under 50 lines), and extract complex logic into separate domain-specific files

Applied to files:

  • packages/kit/src/template.ts
📚 Learning: 2025-11-25T11:42:16.132Z
Learnt from: CRRepo: nuxt/nuxt PR: 0File: .github/copilot-instructions.md:0-0Timestamp: 2025-11-25T11:42:16.132ZLearning: Applies to **/*.vue : Use `<script setup lang="ts">` and the composition API when creating Vue components

Applied to files:

  • packages/kit/src/template.ts
📚 Learning: 2025-11-25T11:42:16.132Z
Learnt from: CRRepo: nuxt/nuxt PR: 0File: .github/copilot-instructions.md:0-0Timestamp: 2025-11-25T11:42:16.132ZLearning: Applies to **/*.{ts,tsx,js,jsx,vue} : Add comments only to explain complex logic or non-obvious implementations

Applied to files:

  • packages/kit/src/template.ts
📚 Learning: 2025-11-25T11:42:16.132Z
Learnt from: CRRepo: nuxt/nuxt PR: 0File: .github/copilot-instructions.md:0-0Timestamp: 2025-11-25T11:42:16.132ZLearning: Applies to **/*.{ts,tsx,js,jsx,vue} : Use clear, descriptive variable and function names

Applied to files:

  • packages/kit/src/template.ts
🧬 Code graph analysis (1)
packages/nitro-server/src/index.ts (1)
packages/nitro-server/src/utils.ts (1)
  • distDir (11-11)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (18)
  • GitHub Check: test-fixtures (windows-latest, built, rspack, async, manifest-on, json, lts/-1)
  • GitHub Check: test-fixtures (windows-latest, dev, vite, async, manifest-off, json, lts/-1)
  • GitHub Check: test-fixtures (windows-latest, dev, vite, default, manifest-on, json, lts/-1)
  • GitHub Check: test-fixtures (windows-latest, built, webpack, default, manifest-on, json, lts/-1)
  • GitHub Check: test-fixtures (windows-latest, built, vite, async, manifest-off, json, lts/-1)
  • GitHub Check: test-fixtures (windows-latest, dev, vite-env-api, async, manifest-on, json, lts/-1)
  • GitHub Check: test-fixtures (windows-latest, built, vite, default, manifest-on, json, lts/-1)
  • GitHub Check: test-fixtures (windows-latest, dev, vite, default, manifest-off, json, lts/-1)
  • GitHub Check: test-fixtures (ubuntu-latest, built, vite, async, manifest-on, js, lts/-1)
  • GitHub Check: test-fixtures (ubuntu-latest, built, vite-env-api, default, manifest-on, json, lts/-1)
  • GitHub Check: test-fixtures (ubuntu-latest, built, vite, async, manifest-off, json, lts/-1)
  • GitHub Check: test-fixtures (ubuntu-latest, dev, vite, async, manifest-off, json, lts/-1)
  • GitHub Check: test-benchmark
  • GitHub Check: typecheck (ubuntu-latest, bundler)
  • GitHub Check: release-pkg-pr-new
  • GitHub Check: typecheck (windows-latest, bundler)
  • GitHub Check: test-size
  • GitHub Check: code
🔇 Additional comments (3)
packages/nitro-server/src/index.ts (1)

573-573:No-opcatch is OK here—please just ensure “best-effort” is intended.

Both operations (cache dir cleanup; optional symlink) swallowing errors is reasonable if failures shouldn’t block build, and the change is behaviour-preserving. Worth a quick sanity check that you don’t need debug logging for diagnosing permissions/filesystem issues.

Also applies to: 731-731

packages/kit/src/template.ts (2)

367-415:appTsConfig → globaltsConfig → defaults merge order looks right.

This matches the desired override model: app-specific config can override global settings while still inheriting the shared baseline.


418-442:Node/shared now inherit globaltsConfig—please verify intended inheritance scope.

This implements the “apply global tsConfig everywhere” behaviour fortsconfig.node.json andtsconfig.shared.json. Please confirm whetheronlynodeTsConfig/sharedTsConfig + tsConfig should apply here (current behaviour), or whetherappTsConfig should also be inherited by node/shared (since the issue discussion mentioned additional per-context keys likenodeTsConfig/sharedTsConfig).

@danielroedanielroe added this to the4.3 milestoneDec 16, 2025
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

@coderabbitaicoderabbitai[bot]coderabbitai[bot] left review comments

@danielroedanielroeAwaiting requested review from danielroedanielroe is a code owner

@cernymatejcernymatejAwaiting requested review from cernymatej

At least 1 approving review is required to merge this pull request.

Assignees

No one assigned

Projects

None yet

Milestone

4.3

Development

Successfully merging this pull request may close these issues.

easier way to define globaltsconfig options

3 participants

@Subham-KRLX@cernymatej@danielroe

[8]ページ先頭

©2009-2025 Movatter.jp