Repository navigation
fix(plugin-routing): improve better-auth client alias resolution in dev mode - #572
Open
MaxtuneLee wants to merge 1 commit into
Open
MaxtuneLee wants to merge 1 commit into
MaxtuneLee wants to merge 1 commit into
Conversation
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Close #565
better-auth/client/pluginsfails to resolve invoid devwhen auth is enabled. This is because each alias used a stringfind, and vite matches a stringfindagainst the exact id and any id starting withfind + '/', replacing only the prefix.So
better-auth/client/plugins -> …/dist/client/index.mjs/plugins, which doesn't exist.I match the alias with a RegExp
^better-auth/<sub>$, so only the exact specifier is rewritten, other subpaths, includingclient/plugins, now fall through to normal resolution.File touched
packages/void/src/plugin-routing.ts: Use exact-match alias patternspackages/void/test/unit/plugin-routing.test.ts: Add a verificationTest plans
vp test run packages/void/test/unit/plugin-routing.test.ts: 56 passedvp run --filter ./packages/void typecheck: clean.vp fmtapplied to the two changed files.