[PR #2997] [CLOSED] CLI: Use vite to load auth config when we detect a vite project #30195

Closed
opened 2026-04-17 21:21:41 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/better-auth/better-auth/pull/2997
Author: @shreyassanthu77
Created: 6/12/2025
Status: Closed

Base: canaryHead: main


📝 Commits (10+)

📊 Changes

647 files changed (+38444 additions, -9850 deletions)

View changed files

.github/workflows/branch-rules.yml (+0 -36)
📝 .github/workflows/ci.yml (+2 -2)
📝 .github/workflows/e2e.yml (+6 -5)
.github/workflows/main-protect.yml (+0 -18)
📝 .github/workflows/preview.yml (+2 -2)
📝 .github/workflows/release.yml (+11 -6)
📝 CONTRIBUTING.md (+30 -6)
📝 README.md (+1 -1)
📝 biome.json (+4 -2)
demo/expo-example/.env.example (+7 -0)
demo/expo-example/.gitignore (+20 -0)
demo/expo-example/README.md (+15 -0)
demo/expo-example/app.config.ts (+55 -0)
demo/expo-example/assets/bg-image.jpeg (+0 -0)
demo/expo-example/assets/fonts/SpaceMono-Regular.ttf (+0 -0)
demo/expo-example/assets/icon.png (+0 -0)
demo/expo-example/assets/images/adaptive-icon.png (+0 -0)
demo/expo-example/assets/images/favicon.png (+0 -0)
demo/expo-example/assets/images/logo.png (+0 -0)
demo/expo-example/assets/images/partial-react-logo.png (+0 -0)

...and 80 more files

📄 Description

When using frameworks that build on top of vite, some imports may not be resolved correctly when using jiti (like path aliases, virtual modules etc)

so this pr uses vite to try and resolve a config file and if one exists we use that with all the plugins enabled to load the auth config file so that will make sure all the imports are resolved properly and any vite specific logic need not be stubbed out just to use the better auth cli

Few Considerations

  • this pr currently adds vite as a dep which means a few things
    1. This pr is using a pinned version of vite instead of using the project's version which could mean mismatching plugin versions, available APIs, etc
    2. This pr is also using an API marked experimental from vite runnerImport but it's implementation has been pretty much unchanged in versions 6.2, 6.3, 7-beta so I think they will stablize it with the environments API
    3. Increased bloat when the project most probably already has vite installed
  • some frameworks like astro and solid start wrap vite so we might need special handling for them (or leave it as is and just let it fallback to jiti?)
  • no tests have been implemented for the new code

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/better-auth/better-auth/pull/2997 **Author:** [@shreyassanthu77](https://github.com/shreyassanthu77) **Created:** 6/12/2025 **Status:** ❌ Closed **Base:** `canary` ← **Head:** `main` --- ### 📝 Commits (10+) - [`9664b9a`](https://github.com/better-auth/better-auth/commit/9664b9a834a26f9735cc99bb6adf4f7e4751bd0f) feat: waku integration guide (#3990) - [`2852122`](https://github.com/better-auth/better-auth/commit/28521222bf7e2bc99051e87b5cfd13fc6a48fbbd) refactor: move mockLogger into the specific test file (#4931) - [`458cb20`](https://github.com/better-auth/better-auth/commit/458cb207ccf4836e17f9578a138f05bd2ff6b303) feat: add support for custom callback for authorization url (#4919) - [`574b962`](https://github.com/better-auth/better-auth/commit/574b9624f0a00dd8373f11182f0c78a6f408f71a) perf: improve type `Auth` (#4930) - [`1e7c173`](https://github.com/better-auth/better-auth/commit/1e7c173be440349809259ed68c37a1e5689c08ae) chore: update demo readme - [`555b772`](https://github.com/better-auth/better-auth/commit/555b772e2997e47d2bc29ca97830288f0367c5d2) chore: lint - [`80b8c47`](https://github.com/better-auth/better-auth/commit/80b8c47314901c00a9c81d4989e760daca5bf53f) fix: refresh secondary storage sessions on user update (#4522) - [`5f4c736`](https://github.com/better-auth/better-auth/commit/5f4c7369928da2960e010d10d5bc5f3bb34b7a17) chore: misc - [`1b49c39`](https://github.com/better-auth/better-auth/commit/1b49c3970166411b4d4041346c818bb3d996001e) fix: refresh secondary storage sessions on user update (#4522) - [`1e60e97`](https://github.com/better-auth/better-auth/commit/1e60e97f32249c1abbf903da87251b7fe72fa389) docs: add ai chat assistant for better-auth docs (#4735) ### 📊 Changes **647 files changed** (+38444 additions, -9850 deletions) <details> <summary>View changed files</summary> ➖ `.github/workflows/branch-rules.yml` (+0 -36) 📝 `.github/workflows/ci.yml` (+2 -2) 📝 `.github/workflows/e2e.yml` (+6 -5) ➖ `.github/workflows/main-protect.yml` (+0 -18) 📝 `.github/workflows/preview.yml` (+2 -2) 📝 `.github/workflows/release.yml` (+11 -6) 📝 `CONTRIBUTING.md` (+30 -6) 📝 `README.md` (+1 -1) 📝 `biome.json` (+4 -2) ➕ `demo/expo-example/.env.example` (+7 -0) ➕ `demo/expo-example/.gitignore` (+20 -0) ➕ `demo/expo-example/README.md` (+15 -0) ➕ `demo/expo-example/app.config.ts` (+55 -0) ➕ `demo/expo-example/assets/bg-image.jpeg` (+0 -0) ➕ `demo/expo-example/assets/fonts/SpaceMono-Regular.ttf` (+0 -0) ➕ `demo/expo-example/assets/icon.png` (+0 -0) ➕ `demo/expo-example/assets/images/adaptive-icon.png` (+0 -0) ➕ `demo/expo-example/assets/images/favicon.png` (+0 -0) ➕ `demo/expo-example/assets/images/logo.png` (+0 -0) ➕ `demo/expo-example/assets/images/partial-react-logo.png` (+0 -0) _...and 80 more files_ </details> ### 📄 Description When using frameworks that build on top of vite, some imports may not be resolved correctly when using jiti (like path aliases, virtual modules etc) so this pr uses vite to try and resolve a config file and if one exists we use that with all the plugins enabled to load the auth config file so that will make sure all the imports are resolved properly and any vite specific logic need not be stubbed out just to use the better auth cli ## Few Considerations - this pr currently adds vite as a dep which means a few things 1. This pr is using a pinned version of vite instead of using the project's version which could mean mismatching plugin versions, available APIs, etc 1. This pr is also using an API marked experimental from vite `runnerImport` but it's implementation has been pretty much unchanged in versions 6.2, 6.3, 7-beta so I think they will stablize it with the environments API 1. Increased bloat when the project most probably already has vite installed - some frameworks like astro and solid start wrap vite so we might need special handling for them (or leave it as is and just let it fallback to jiti?) - no tests have been implemented for the new code --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
GiteaMirror added the pull-request label 2026-04-17 21:21:41 -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#30195