-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Description
Before opening, please confirm:
- I have searched for duplicate or closed issues and discussions.
- I have read the guide for submitting bug reports.
- I have done my best to include a minimal, self-contained set of instructions for consistently reproducing the issue.
JavaScript Framework
Not applicable, Web Components
Amplify APIs
Authentication
Amplify Version
v6
Amplify Categories
auth
Backend
Amplify Gen 2
Environment information

Hello, I'm playing with using Amplify for authentication since Cognito supports so many options. Once concern I have is that the library seems to be larger than the rest of my app for the frontend/typescript. The total seems to be 120kb (see screenshot) when I am literally just using the login/refresh/challenge parts of the library.
It might be worth a development cycle to try to figure out how to reduce the size of the bundle of the core authentication logic. I can't help but thing a lot of unneeded stuff is pulled in but can't be tree shaken for some reason.
These are my current amplify imports:
import { Amplify } from "aws-amplify";
import { fetchAuthSession, getCurrentUser } from "aws-amplify/auth";
import {
confirmResetPassword,
confirmSignIn,
confirmSignUp,
resetPassword,
signIn,
signOut,
signUp,
updatePassword,
} from "aws-amplify/auth/cognito";
It doesn't seem that amplify supports default imports which can do a lot to help with this kind of bundle size.
Example:
import fetchAuthSession from "aws-amplify/auth/fetchAuthSession";
My amplify version:
"aws-amplify": "^6.15.4"
Thank you in advance!
Describe the bug
Hello, I'm playing with using Amplify for authentication since Cognito supports so many options. Once concern I have is that the library seems to be larger than the rest of my app for the frontend/typescript. The total seems to be 120kb (see screenshot) when I am literally just using the login/refresh/challenge parts of the library.
It might be worth a development cycle to try to figure out how to reduce the size of the bundle of the core authentication logic. I can't help but thing a lot of unneeded stuff is pulled in but can't be tree shaken for some reason.
Expected behavior
I would expect the bundle size to below 10kb. It's more like 120k.
Reproduction steps
Use the typescript version of amplify in a project. Bundle with esbuild.
Code Snippet
// Put your code below this line.
Log output
// Put your logs below this line
aws-exports.js
No response
Manual configuration
No response
Additional configuration
No response
Mobile Device
No response
Mobile Operating System
No response
Mobile Browser
No response
Mobile Browser Version
No response
Additional information and screenshots
No response