Skip to content

fix(db): resolve Nuxt aliases in schema bundling#802

Merged
atinux merged 5 commits intonuxt-hub:mainfrom
onmax:fix/db-schema-nuxt-aliases
Jan 30, 2026
Merged

fix(db): resolve Nuxt aliases in schema bundling#802
atinux merged 5 commits intonuxt-hub:mainfrom
onmax:fix/db-schema-nuxt-aliases

Conversation

@onmax
Copy link
Copy Markdown
Contributor

@onmax onmax commented Jan 23, 2026

Closes #800

Summary

Schema files bundled via tsdown didn't resolve Nuxt aliases (#shared, ~, @). Now passes nuxt.options.alias to buildDatabaseSchema() so tsdown can resolve them.

StackBlitz

Link Expected
Bug nuxthub-800 ❌ Build fails
Fix nuxthub-800-fixed ✅ Build succeeds

CLI Reproduction

git clone --depth 1 --filter=blob:none --sparse https://github.com/onmax/repros.git
cd repros && git sparse-checkout set nuxthub-800
cd nuxthub-800 && pnpm i && pnpm build

Verify fix

git sparse-checkout add nuxthub-800-fixed
cd ../nuxthub-800-fixed && pnpm i && pnpm build

The -fixed folder uses pnpm patch to apply the fix locally.

Related

@vercel
Copy link
Copy Markdown

vercel bot commented Jan 23, 2026

@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 Jan 23, 2026

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

commit: b588418

@atinux
Copy link
Copy Markdown
Contributor

atinux commented Jan 29, 2026

I'm good with this, but the CLI commands might keep failing as buildDatabaseSchema is called in generate and squash commands ⚠️

@onmax
Copy link
Copy Markdown
Contributor Author

onmax commented Jan 29, 2026

I'm good with this, but the CLI commands might keep failing as buildDatabaseSchema is called in generate and squash commands ⚠️

mmm, should i try to reproduce this and mitigate issues or keep it like this and fix in the future?

Copy link
Copy Markdown
Contributor

atinux commented Jan 29, 2026

I guess for CLI we could maybe give at least the #shared and #server default alias as we now the relativeDir, wdyt @onmax?

@onmax
Copy link
Copy Markdown
Contributor Author

onmax commented Jan 29, 2026

@atinux Added CLI support - generate and squash commands now read aliases from .nuxt/tsconfig.json

import { join, resolve } from 'pathe'
import { buildDatabaseSchema } from '@nuxthub/core/db'

async function getTsconfigAliases(cwd) {
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Is it better to getTsconfigAliases be inside utils/db.mjs instead of duplicate it?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Done in b588418. Thanks for the suggestion @baianux!

@atinux atinux merged commit 48db817 into nuxt-hub:main Jan 30, 2026
7 of 9 checks passed
@onmax onmax deleted the fix/db-schema-nuxt-aliases branch January 30, 2026 09:17
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.

🐞 NuxtHub 0.10.5: server/db/schema imports break when using #shared alias

3 participants