You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
The auth guide's @auth-schema alias passes typecheck and void db generate, but vp dev cannot resolve it #900
With that, tsc --noEmit and void db generate pass, but the dev server does not start:
(!) Failed to run dependency scan. Skipping dependency pre-bundling. Error: The following dependencies are imported but could not be resolved:
@auth-schema (imported by …/db/schema.ts)
error when starting dev server:
Error: Cannot find module '@auth-schema' imported from '…/db/schema.ts'
.void/better-auth-schema.ts exists at this point (void prepare has run), so this is not the fresh-clone case fixed in #823.
Turn auth on: auth: { providers: ['email'] } in void.config.ts, then void prepare
Add the paths above to the root tsconfig.json (keeping the ones from .void/tsconfig.json, as the guide says)
Add the posts table above to db/schema.ts
vp dev → the error above
Cause
The CLI loads modules with tsconfigPaths: true (projectAuthConfigImporter), so the alias resolves there. The dev server uses the app's vite.config.ts, and the one void init writes does not set resolve.tsconfigPaths, so nothing resolves @auth-schema. Void's plugin aliases only @schema.
Adding resolve: { tsconfigPaths: true } to vite.config.ts makes vp dev start. Void's own test/integration/auth-schema-startup.test.ts sets it in its Vite config too, so the test passes while the guide's steps do not.
Proposal
Either:
have voidPlugin() alias @auth-schema the way it aliases @schema, so the guide's steps work as written (and @auth-schema would no longer need a tsconfig entry that replaces the inherited paths), or
say in the guide that vite.config.ts needs resolve: { tsconfigPaths: true }.
Related: #823 (fresh clone), #872 (void db seed does not resolve tsconfig aliases).
Activity