Skip to content

fix(cli): resolve tsconfig aliases in database seeds - #873

Open
karthickeyan-dev wants to merge 5 commits into
voidzero-dev:mainfrom
karthickeyan-dev:fix/db-seed-tsconfig-paths-872
Open

karthickeyan-dev wants to merge 5 commits into
voidzero-dev:mainfrom
karthickeyan-dev:fix/db-seed-tsconfig-paths-872

Conversation

@karthickeyan-dev

@karthickeyan-dev karthickeyan-dev commented Nov 18, 2026 •

Copy link
Copy Markdown
Contributor

void db seed now resolves seed and schema imports using the application's tsconfig paths, including @auth-schema references used by foreign keys.

Build a runtime path map with get-tsconfig, excluding .d.ts, .d.mts, and .d.cts targets while preserving inheritance, base URLs, wildcards, and fallback targets. This prevents generated aliases such as void/routes from replacing runtime helpers with declarations. Jiti receives a temporary config that remains available through seed execution and is removed afterwards.

Regression coverage exercises auth foreign keys, schema files and directories, generated declaration aliases with routeUrl(), mixed declaration/runtime targets, dynamic imports, and CommonJS JavaScript seeds. The seeding guide documents alias support.

Closes #872.

Validation:

  • Seed tests: 13 passed, including reproduction of the reviewed failure before the fix
  • vp run build:all, vp check, vp run check:types, and build-artifact checks
  • vp run test --list and vp run test
  • vp test run: 827 files and 17,827 tests passed; 1 file and 39 tests skipped
  • Full packed npm/pnpm matrix across React, Vue, Svelte, and Solid
  • Packed Vite+ starter checks with npm and pnpm
  • Freshly installed CLI: void prepare followed by a SQLite seed using generated aliases, routeUrl(), and a dynamic @schema import

@karthickeyan-dev
karthickeyan-dev requested a review from a team as a code owner November 18, 2026 05:40

@cpojer cpojer left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

The TypeScript case looks good now and routeUrl() still works. The JavaScript behavior worries me though. Can we make .mjs and ESM .js use the same alias resolution as .ts, including for await import()?

Right now, with the same import and tsconfig, seed.ts seeds from the local fixture, but seed.mjs seeds from node_modules if there’s a package with the same name. Changing the file extension shouldn’t change what data ends up in the database.

One smaller thing: a seed that doesn’t use aliases used to work before void prepare. Now it fails if .void/tsconfig.json is missing. Can we update it so the error tells people to run void prepare?

This branch has not been deployed

No deployments
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.

void db seed cannot resolve @auth-schema imports in database schemas

2 participants