fix(db): create package.json during prepare#797
Conversation
|
@onmax is attempting to deploy a commit to the NuxtLabs Team on Vercel. A member of the Team first needs to authorize it. |
commit: |
5b7c595 to
a05b4c2
Compare
be858c9 to
06bfa38
Compare
06bfa38 to
b2af614
Compare
|
@onmax
|
|
Thank you for the report. Just pushed a fix - removed the pnpm add @nuxthub/core@https://pkg.pr.new/@nuxthub/core@797Mind retrying |
|
I can confirm that after running This error does not appear with just |
|
I tested with a repro using actual schema types: // server/api/users.ts
import { db, schema } from '@nuxthub/db'
export default defineEventHandler(async () => {
const result = await db.select().from(schema.users)
return result
})
PR fixes TS5090 path resolution. Couldn't reproduce the DrizzleTypeError specifically @mateusznarowski - could you share your exact schema/usage? |
During build, Nuxt uses node_modules/.cache/nuxt/.nuxt/ as buildDir where tsdown doesn't generate .d.mts. Fall back to .nuxt/ for types. Also: - Merge build+copy into single hook (prevent race condition) - Only write stubs if files don't exist (prevent overwriting)
|
@mateusznarowski Thanks for the repro! I tracked down the issue: Root cause: During Fix (commit dc6d7d2):
Can you try with the latest from this PR? pnpm add @nuxthub/core@https://pkg.pr.new/@nuxthub/core@797The fix reproduction is here: https://stackblitz.com/github/onmax/repros/tree/main/drizzle-error-797-fix?startScript=build |
|
I checked PS I don't know if you could do anything about it, but I also have an annoying bug in @nuxt/content that I care about, so if you could raise it somewhere, I would be very grateful. |
|
if you have a repro, I would be more than happy to help you. Please open an issue and mention me :) |
|
@onmax Thanks in advance 🙏 |

Closes #796
Closes #801
Summary
Cyclic TS errors with
hub:dbafter nuxt prepare (db types and path aliases) #796: Duringnuxt prepare,@nuxthub/dbwas missingpackage.jsonand schema files → TS5090 errors. Fixed by creating stubs insetupDatabaseClient.TypeScript definitions are lost when running Vitest via
@nuxt/test-utils#801: Vitest with@nuxt/test-utilschangesbuildDir, causing schema copy to overwrite types with stubs. Fixed by skipping copy whenVITESTenv is set.DrizzleTypeError with
db.query.*: Duringnuxt buildwithtypescript.typeCheck: 'build', buildDir isnode_modules/.cache/nuxt/.nuxt/where tsdown doesn't generate.d.mts. Fixed by falling back to.nuxt/for types, merging hooks to prevent race condition, and only writing stubs if files don't exist.Reproductions
db.query.usersfails