Title: fix(auth): match the dev better-auth client aliases exactly by Brooooooklyn · Pull Request #587 · voidzero-dev/void · GitHub
Open Graph Title: fix(auth): match the dev better-auth client aliases exactly by Brooooooklyn · Pull Request #587 · voidzero-dev/void
X Title: fix(auth): match the dev better-auth client aliases exactly by Brooooooklyn · Pull Request #587 · voidzero-dev/void
Description: Fixes #565 Problem With auth on, vp dev aliases five better-auth subpaths to files in Void's own copy of better-auth. Each alias used a string find, and in Vite a string find also matches every deeper path: alias find 'better-auth/client' → …/better-auth/dist/client/index.mjs import 'better-auth/client' → …/dist/client/index.mjs ✓ import 'better-auth/client/plugins' → …/dist/client/index.mjs/plugins ✗ (no such file) So any app that passes a Better Auth client plugin (adminClient(), organizationClient(), …) to createAuthClient broke in dev: the client failed with Failed to resolve import "better-auth/client/plugins"; SSR returned 500 (No such module …). vp build adds no alias, so it was fine. Fix Each find is now an anchored RegExp, ^better-auth/$. Vite's alias API has only two kinds of find: a string, which also matches deeper paths, or a RegExp. So a RegExp is the only way to get an exact match. The repo already does the same ({ find: /^void$/ } in cli/wrapper.ts). before (string) after (exact) better-auth/client Void's copy ✓ Void's copy ✓ (unchanged) better-auth/react|vue|svelte|solid Void's copy ✓ Void's copy ✓ (unchanged) better-auth/client/plugins broken path ✗ normal resolution ✓ The five exact ids get the same replacement in every Vite step that reads resolve.alias: the alias plugin; vite:pre-alias; SSR externalization; the dependency optimizer. So the cold-cache reload protection from #24 (the reason the aliases exist) is kept. Checks New test in plugin-routing.test.ts. It starts a real Vite dev server with auth on and resolves: better-auth/client and /react from an app file, which has no better-auth of its own. They resolve only through the aliases, to Void's copy. better-auth/client/plugins from inside the package. It resolves to dist/client/plugins/index.mjs. Mutation check: the test fails with the old string find and with no aliases at all. Scratch app from the issue: a React pages app, auth on, adminClient() from better-auth/client/plugins, cold cache, vp dev. before after SSR GET / 500 No such module 200, authClient.admin.listUsers is a function client module 500 Failed to resolve 200 void typecheck, lint and fmt pass. Affected tests (vp run test, 508 files) pass. Not changed here client/plugins is not pinned to Void's copy. The issue mentions this as optional. Without it, the user's own better-auth provides client/plugins, as in vp build, and Vite discovers it like any other dependency. That costs one optimizer reload on the first cold-cache page that imports it. Pinning would point the import at Void's better-auth version instead of the one the app installed. That's a product decision, so I left it out. 🤖 Generated with Claude Code
Open Graph Description: Fixes #565 Problem With auth on, vp dev aliases five better-auth subpaths to files in Void's own copy of better-auth. Each alias used a string find, and in Vite a string find also matches every...
X Description: Fixes #565 Problem With auth on, vp dev aliases five better-auth subpaths to files in Void's own copy of better-auth. Each alias used a string find, and in Vite a string find also matches e...
Opengraph URL: https://github.com/voidzero-dev/void/pull/587
X: @github
Domain: github.com
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| route-pattern | /:user_id/:repository/pull/:id/files(.:format) |
| route-controller | pull_requests |
| route-action | files |
| fetch-nonce | v2:32e8556c-6d1b-d4cb-f510-e492241b5a2a |
| current-catalog-service-hash | ae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b |
| request-id | B7D2:79CC9:1E761A:29F03D:6AFBAE7D |
| html-safe-nonce | 45d36d1577b7bff5648d9d9f035440c994cb28bdbd664e21af20e34a59dd24b8 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJCN0QyOjc5Q0M5OjFFNzYxQToyOUYwM0Q6NkFGQkFFN0QiLCJ2aXNpdG9yX2lkIjoiNzE3MTE1MjMxNTc1ODEyODc2NSIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | d0f013b85df3148000aa853f113f8591d635612a0d2866b5d3eb5facbfcd7a1e |
| hovercard-subject-tag | pull_request:5011629360 |
| github-keyboard-shortcuts | repository,pull-request-list,pull-request-conversation,pull-request-files-changed,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/voidzero-dev/void/pull/587/files |
| twitter:image | https://avatars.githubusercontent.com/u/3468483?s=400&v=4 |
| twitter:card | summary_large_image |
| og:image | https://avatars.githubusercontent.com/u/3468483?s=400&v=4 |
| og:image:alt | Fixes #565 Problem With auth on, vp dev aliases five better-auth subpaths to files in Void's own copy of better-auth. Each alias used a string find, and in Vite a string find also matches every... |
| og:site_name | GitHub |
| og:type | object |
| hostname | github.com |
| expected-hostname | github.com |
| None | e25fbd830d3e6ad0e8935c105cf4fdc70c593dffcd27bb45b790ae4fece5ea55 |
| turbo-cache-control | no-preview |
| diff-view | unified |
| go-import | github.com/voidzero-dev/void git https://github.com/voidzero-dev/void.git |
| octolytics-dimension-user_id | 149750581 |
| octolytics-dimension-user_login | voidzero-dev |
| octolytics-dimension-repository_id | 1164437080 |
| octolytics-dimension-repository_nwo | voidzero-dev/void |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 1164437080 |
| octolytics-dimension-repository_network_root_nwo | voidzero-dev/void |
| turbo-body-classes | logged-out env-production page-responsive full-width |
| disable-turbo | true |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 08c8f17f9d27054a108b8b6254e405de0151f660 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width