[GH-ISSUE #9185] tracking: package shipping (exports, optional peers, CLI dlx resolution) #19934

Open
opened 2026-04-15 19:18:24 -05:00 by GiteaMirror · 0 comments
Owner

Originally created by @gustavovalverde on GitHub (Apr 14, 2026).
Original GitHub issue: https://github.com/better-auth/better-auth/issues/9185

Summary

Package shipping problems appear in three places: exports and bundle boundaries, optional peer dependency installs, and CLI runtime resolution under dlx or npx. Client bundles can pull server-only code or miss expected exports. Install flows can pull optional dependencies into --omit=dev and container builds. The CLI can also fail to resolve its own dependencies or load project config in some runtimes. generate output quality is adjacent but separate from packaging.

Root cause

17a Exports + bundle: the better-auth root entry can re-export server and client code through the same surface, optional runtime dependencies are not consistently modeled, the generated @better-auth/core/error subpath can miss APIError, and samlify CJS or ESM interop can fail at deploy time.

17b Install-surface optional peers: optional peers declared on better-auth can still resolve under npm ci --omit=dev, some builds compile SQLite dependencies even when unused, and transitive dependency ranges remain broader than intended.

17c CLI dlx/config-loader: npx and dlx execution can miss peer dependencies in the sandbox, the jiti config-loader can fail under deno and some NestJS or Prisma layouts, and CLI version skew can produce incorrect output without a warning.

Scope

In: better-auth package exports map, bundle tree-shaking, optional-peer resolution on install, CLI runtime self-containment and config-loader robustness.

Out: CLI generate codegen quality (Drizzle pgSchema and related codegen issues): either move to the OpenAPI/schema cluster or a new codegen tracker once the tail is worth it.

Resolution criteria

  • Client bundles do not include server-only modules after import from better-auth.
  • APIError is reachable from @better-auth/core/error at every supported subpath.
  • samlify/@better-auth/infra imports succeed on Netlify and similar ESM-strict environments.
  • npm ci --omit=dev does not install optional peers listed on the leaf package.
  • Docker images without the SQLite adapter do not compile better-sqlite3.
  • npx @better-auth/cli runs without a missing-module error on a clean environment.
  • The CLI warns when its version is skewed from the installed better-auth.
  • @better-auth/cli generate succeeds under deno and NestJS Prisma layouts.

Related

  • Making kysely optional would retire multiple export and install-surface failures tracked here.
  • The codegen outlier can move to a dedicated tracker if that tail grows.
Originally created by @gustavovalverde on GitHub (Apr 14, 2026). Original GitHub issue: https://github.com/better-auth/better-auth/issues/9185 ## Summary Package shipping problems appear in three places: exports and bundle boundaries, optional peer dependency installs, and CLI runtime resolution under `dlx` or `npx`. Client bundles can pull server-only code or miss expected exports. Install flows can pull optional dependencies into `--omit=dev` and container builds. The CLI can also fail to resolve its own dependencies or load project config in some runtimes. `generate` output quality is adjacent but separate from packaging. ## Root cause **17a Exports + bundle:** the `better-auth` root entry can re-export server and client code through the same surface, optional runtime dependencies are not consistently modeled, the generated `@better-auth/core/error` subpath can miss `APIError`, and samlify CJS or ESM interop can fail at deploy time. **17b Install-surface optional peers:** optional peers declared on `better-auth` can still resolve under `npm ci --omit=dev`, some builds compile SQLite dependencies even when unused, and transitive dependency ranges remain broader than intended. **17c CLI dlx/config-loader:** `npx` and `dlx` execution can miss peer dependencies in the sandbox, the jiti config-loader can fail under deno and some NestJS or Prisma layouts, and CLI version skew can produce incorrect output without a warning. ## Scope **In:** `better-auth` package `exports` map, bundle tree-shaking, optional-peer resolution on install, CLI runtime self-containment and config-loader robustness. **Out:** CLI `generate` codegen quality (Drizzle pgSchema and related codegen issues): either move to the OpenAPI/schema cluster or a new codegen tracker once the tail is worth it. ## Resolution criteria - Client bundles do not include server-only modules after import from `better-auth`. - `APIError` is reachable from `@better-auth/core/error` at every supported subpath. - samlify/`@better-auth/infra` imports succeed on Netlify and similar ESM-strict environments. - `npm ci --omit=dev` does not install optional peers listed on the leaf package. - Docker images without the SQLite adapter do not compile `better-sqlite3`. - `npx @better-auth/cli` runs without a missing-module error on a clean environment. - The CLI warns when its version is skewed from the installed `better-auth`. - `@better-auth/cli generate` succeeds under deno and NestJS Prisma layouts. ## Related - Making `kysely` optional would retire multiple export and install-surface failures tracked here. - The codegen outlier can move to a dedicated tracker if that tail grows.
GiteaMirror added the trackingdependenciesdevtools labels 2026-04-15 19:18:25 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/better-auth#19934