Skip to content

fix(db): generate schema types during nuxt prepare#758

Merged
atinux merged 1 commit intonuxt-hub:mainfrom
onmax:fix/db-schema-prepare
Jan 13, 2026
Merged

fix(db): generate schema types during nuxt prepare#758
atinux merged 1 commit intonuxt-hub:mainfrom
onmax:fix/db-schema-prepare

Conversation

@onmax
Copy link
Copy Markdown
Contributor

@onmax onmax commented Dec 30, 2025

Fixes #755

Problem

nuxt prepare does not generate .nuxt/hub/db/schema.mjs and schema.d.mts. Breaks CI typecheck on clean .nuxt.

The !nuxt.options._prepare guard was added in #693 following a pattern of skipping expensive work during prepare. However, buildDatabaseSchema() only compiles TypeScript schema files to JavaScript via tsdowm; a pure compilation step with no side effects. Since types depend on this compiled output, skipping it during prepare breaks typecheck workflows

Reproduce bug

git clone --depth 1 --filter=blob:none --sparse https://github.com/onmax/repros.git
cd repros && git sparse-checkout set nuxthub-755
cd nuxthub-755 && pnpm i && rm -rf .nuxt && pnpm prepare
ls .nuxt/hub/db/  # schema.mjs missing

Verify fix

git clone --depth 1 --filter=blob:none --sparse https://github.com/onmax/repros.git
cd repros && git sparse-checkout set nuxthub-755-fixed
cd nuxthub-755-fixed && pnpm i && rm -rf .nuxt && pnpm prepare
ls .nuxt/hub/db/  # schema.mjs exists

The -fixed folder includes a pnpm patch with the fix.

@vercel
Copy link
Copy Markdown

vercel bot commented Dec 30, 2025

@onmax is attempting to deploy a commit to the NuxtLabs Team on Vercel.

A member of the Team first needs to authorize it.

@pkg-pr-new
Copy link
Copy Markdown

pkg-pr-new bot commented Dec 30, 2025

npm i https://pkg.pr.new/@nuxthub/core@758

commit: 0fa713a

@vercel
Copy link
Copy Markdown

vercel bot commented Jan 13, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Review Updated (UTC)
nuxthub Ready Ready Preview Jan 13, 2026 1:45pm

@atinux atinux merged commit 566a81c into nuxt-hub:main Jan 13, 2026
9 checks passed
@atinux
Copy link
Copy Markdown
Contributor

atinux commented Jan 16, 2026

Hum by checking, I think this breaks the first npx nuxi prepare:

⛰  nuxthub-workflow/ npx nuxi prepare

[5:56:24 PM]  ERROR  [UNHANDLEABLE_ERROR] Error: Something went wrong inside rolldown, please report this problem at https://github.com/rolldown/rolldown/issues.
Tsconfig not found /Users/atinux/Downloads/nuxthub-workflow/.nuxt/tsconfig.app.json

Caused by:
    Failed to resolve tsconfig option: /Users/atinux/Downloads/nuxthub-workflow/tsconfig.json

This is because nuxi prepare generates the types after the modules: https://github.com/nuxt/cli/blob/51bd75ba97ed058f854722525bbde39b345e7b75/packages/nuxi/src/commands/prepare.ts#L49

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

DB schema is not generated on nuxt prepare hook

2 participants