nuxt-auth-utils
nuxt-auth-utils copied to clipboard
Prefer Single Exports Over `oauth`
Currently, users will set up their endpoints by accessing one of the oauth.*.
export const oauth = {
githubEventHandler,
spotifyEventHandler,
googleEventHandler,
twitchEventHandler,
auth0EventHandler,
microsoftEventHandler,
discordEventHandler,
battledotnetEventHandler,
keycloakEventHandler,
linkedinEventHandler,
cognitoEventHandler
};
This works and the auto-completion is nice but I think it can be improved:
- treeshaking afaik won't work as all providers are within the same const, meaning we will bundle all providers (which will grow)
oauthseems likely for collisions in global import namespace
Exporting each provider as its own function should fix tree shaking and namespace problems, i.e authGoogleEventHandler where autocompletion should be good.
Agree with you, I though about it as well at first and forgot about treeshaking.
Will be a breaking chance then, adding it for next major version.