-
Notifications
You must be signed in to change notification settings - Fork 26k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Optimise bundle size for with-supertokens example (#31040)
This PR optimises the bundle size sent to the frontend for nextJS apps by lazy loading the SuperTokens backend SDK only when it's needed.
- Loading branch information
1 parent
d2c1888
commit 155aaa3
Showing
6 changed files
with
51 additions
and
44 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
const port = process.env.APP_PORT || 3000 | ||
|
||
const apiBasePath = '/api/auth/' | ||
|
||
export const websiteDomain = | ||
process.env.APP_URL || | ||
process.env.NEXT_PUBLIC_APP_URL || | ||
`http://localhost:${port}` | ||
|
||
export const appInfo = { | ||
appName: 'SuperTokens Demo App', | ||
websiteDomain, | ||
apiDomain: websiteDomain, | ||
apiBasePath, | ||
} |
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
import ThirdPartyEmailPasswordReact from 'supertokens-auth-react/recipe/thirdpartyemailpassword' | ||
import SessionReact from 'supertokens-auth-react/recipe/session' | ||
import { appInfo } from './appInfo' | ||
|
||
export let frontendConfig = () => { | ||
return { | ||
appInfo, | ||
recipeList: [ | ||
ThirdPartyEmailPasswordReact.init({ | ||
emailVerificationFeature: { | ||
mode: 'REQUIRED', | ||
}, | ||
signInAndUpFeature: { | ||
providers: [ | ||
ThirdPartyEmailPasswordReact.Google.init(), | ||
ThirdPartyEmailPasswordReact.Github.init(), | ||
], | ||
}, | ||
}), | ||
SessionReact.init(), | ||
], | ||
} | ||
} |
This file contains 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
This file contains 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
This file contains 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