-
Notifications
You must be signed in to change notification settings - Fork 2.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
modularization/tree shaking not working? (3.0.10) #5714
Comments
I forgot to note, I also use these Auth calls:
|
Hey @jliebrand, to keep backwards compatibility we kept
Then you can use it like:
Let me know if this helps. |
Hi @jordanranz - thanks for that... Just FYI, none of the docs I found mentioned that, and indeed even the blog post announcement about the modularisation says to just do what I did. Probably good to update the docs, or make a dot-oh release that does break backward compatibility? Anyway, having now tried @aws-amplify/api-rest, that takes my total bundle size down from 462kb to 338kb, so that's a good improvement, but I'm still surprised at the total size. Ultimately all I want is for the auth to do its thing and sign my fetch requests (which is really what the rest api is). I struggle to understand why that would be more than double digits (e.g. 10kb??) Also: does this mean I should also pull in @aws-amplify/core and /auth instead of the normal amplify package? |
@jliebrand You shouldn't have to pull in In my testing a few weeks back with CRA, It looks like you're using |
@ericclemmons - but are you using '@aws-amplify/api-rest' ? I've just run the build again, and separated out aws in to it's own bundle/chunk.
Then in my redux actions:
This results in the following bundle code:
And the actual size of the bundle:
|
@jliebrand Thanks for sharing, this is really helpful! It looks like tree-shaking is working correctly (only dependencies for How does this compare with the previous version of the library? If the numbers are roughly the same, then there's something amiss here. If they're favorable, then the opportunity may be in continuing to improve our bundle sizes. (I'm also curious in the gzip/brotli numbers, since that's what users would see in the wild) |
It's definitely less than original, since graphql is no longer included. I guess I'm just surprised to have to pull down 250kb just to get auth and api... You can build full on apps for less than that, but I guess it is what it is (yeah gzipped it'll be less, but i'm just looking at total weight here) |
Raw numbers do have some sticker shock. The good news is we're trending in the right direction with tree-shaking:
A quick glance at the bundle output points to cross-browser Since it's working, it'd be best for tracking to close this & start a new discussion with how we can cut bundle-size further. If you have suggestions or experience with this, I'd really appreciate your insights on how we can tackle this! |
This issue has been automatically locked since there hasn't been any recent activity after it was closed. Please open a new issue for related bugs. Looking for a help forum? We recommend joining the Amplify Community Discord server |
This is a follow on from previous issues I raised (#488) and also (#3365).
I've just created a brand new app, and I'm pulling in aws-amplify v3. I'm only using auth and api, but the resulting bundle is still 378kb . Am I doing something wrong?
and in my code:
The resulting bundle is 378kb and still includes things like GraphQL? Why is that not removed (with the new tree shaking)?
The text was updated successfully, but these errors were encountered: