Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion packages/void/src/auth/drizzle.ts
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ function resolveSchemaUserConfig(
});
}

return userConfig;
return { ...defaults, ...userConfig };
}

function resolveSchemaOptions(
Expand Down
17 changes: 17 additions & 0 deletions packages/void/src/plugin-routing.ts
Original file line number Diff line number Diff line change
Expand Up @@ -246,6 +246,23 @@ export function routingPlugin(root: string, options: RoutingPluginOptions): Plug
);
},
config(_, env) {
if (env.command === "serve" && options.isAuthEnabled()) {
// Alias better-auth client subpaths to absolute file paths so
// Vite can resolve them during SSR without the bare specifiers
// needing to be hoisted into the user's node_modules (pnpm
// strict mode). Without this, Vite discovers them lazily on
// first auth page load, triggering a disruptive program reload.
const betterAuthSubpaths = ["client", "react", "vue", "svelte", "solid"];
const resolvedAliases = betterAuthSubpaths.flatMap((sub) => {
try {
return [{ find: `better-auth/${sub}`, replacement: resolveFile(`better-auth/${sub}`) }];
} catch {
return [];
}
});
return { resolve: { alias: resolvedAliases } };
}

const entries = validateSsrEntries(root);
if (!entries || env.command !== "build") return;

Expand Down
2 changes: 1 addition & 1 deletion packages/void/src/runtime/better-auth-shared.ts
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ function resolveUserConfig(
return userConfig({ defaults, request, env, dialect });
}

return userConfig;
return { ...defaults, ...userConfig };
Comment thread
cursor[bot] marked this conversation as resolved.
Comment thread
Brooooooklyn marked this conversation as resolved.
}

function assertRuntimeDialect(runtime: VoidAuthRuntimeOptions, dialect: VoidAuthDialect): void {
Expand Down
8 changes: 7 additions & 1 deletion packages/void/test/integration/kitchen-sink.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,13 @@ describe("playground/kitchen-sink", () => {
});

await waitForServer(BASE, 20_000);
}, 30_000);

// Warm up: the first request triggers Vite SSR dep optimization
// (drizzle-orm, vue, hono, etc.) which causes multiple program
// reloads. Wait for the reloads to settle before running tests.
await fetch(BASE).catch(() => {});
await new Promise((resolve) => setTimeout(resolve, 5_000));
Comment thread
Brooooooklyn marked this conversation as resolved.
}, 40_000);

afterAll(async () => {
if (child) await killChild(child);
Expand Down
4 changes: 2 additions & 2 deletions packages/void/test/integration/projects-command.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -88,9 +88,9 @@ describe("runProjectsCommand", () => {
headers: { Authorization: "Bearer test-token" },
});
expect(out).toContain("star-tracker");
expect(out).toContain("https://star-tracker.void.app");
expect(out).toContain("https://star-tracker.staging.void.app");
expect(out).toContain("todo-app");
expect(out).toContain("https://todo-app.void.app");
expect(out).toContain("https://todo-app.staging.void.app");
});

it("prints a friendly message when there are no projects", async () => {
Expand Down
Loading