Skip to content

fix(schema): prefer mjs in hub schema hook#131

Merged
onmax merged 3 commits intomainfrom
fix/129-prefer-mjs-hub-schema
Feb 13, 2026
Merged

fix(schema): prefer mjs in hub schema hook#131
onmax merged 3 commits intomainfrom
fix/129-prefer-mjs-hub-schema

Conversation

@onmax
Copy link
Collaborator

@onmax onmax commented Feb 13, 2026

Summary

  • prefer schema.<dialect>.mjs over schema.<dialect>.ts in hub:db:schema:extend
  • extract schema path selection into resolveHubSchemaPath for deterministic hook behavior
  • add focused regression test for path priority and fallback behavior
  • document the .mjs priority in NuxtHub integration docs

Why

This fixes builds where Nuxt moves buildDir under node_modules/.cache/nuxt/.nuxt and Node refuses type-stripping for .ts files under node_modules.

Fixes #129

Testing

  • pnpm vitest run test/schema-hook-path-priority.test.ts
  • pnpm test ⚠️ fails in test/module.test.ts due existing integration environment issues (port/timeouts and transient module resolution under test output) unrelated to this change

@pkg-pr-new
Copy link

pkg-pr-new bot commented Feb 13, 2026

Open in StackBlitz

npm i https://pkg.pr.new/nuxt-modules/better-auth/@onmax/nuxt-better-auth@131

commit: afd6038

@onmax onmax merged commit cdc8784 into main Feb 13, 2026
3 checks passed
@onmax onmax deleted the fix/129-prefer-mjs-hub-schema branch February 13, 2026 22:18
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.

hub:db:schema:extend prefers .ts over .mjs, breaks build when buildDir is inside node_modules

1 participant