Latest news about Bitcoin and all cryptocurrencies. Your daily crypto news habit.
The latest release of AWS Amplify now includes modular imports. Let’s take a look at what this means in terms of implementation & benchmarking.
Overview
AWS Amplify is a JavaScript library that allows developers to quickly & easily connect their apps to cloud resources to enable functionality like Authentication, GraphQL, Analytics, Chatbots, Serverless functions &Â more.
As the AWS Amplify library grows & more features are added, it’s become apparent that we needed to modularize the library so that developers could import only the features that they needed without any excess code.
This means that you can now import only the individual modules you would like to use:
import Auth from @aws-amplify/authimport Analytics from @aws-amplify/analyticsimport API from @aws-amplify/apiimport Storage from @aws-amplify/storageimport PubSub from @aws-amplify/pubsub
Instead of getting the whole library, unnecessarily increasing the size of your JSÂ bundle:
import { Auth } from '@aws-amplify'
Benchmark
We’ve tested all modules, & they all score 100 in lighthouse for performance and best practice when using GZIP text compression.
Auth and Analytics
Modular builds decreases bundle size by 10% in plain JavaScript
Modular builds decreases time to first meaningful paint by 15% in plain JavaScript.
Auth and Interactions in React
Modular builds decreases overall bundle size by 69% using create-react-app, withAuthenticator, Auth, and Interactions categories.
Modular builds decreases time to first meaningful paint by 17% using create-react-app, withAuthenticator, Auth, and Interactions categories.
Bundle Sizes
Vanilla JavaScript with the entire library: 219 KB GZIPFirst meaningful paint:Â 130ms
Vanilla JavaScript with only Auth and Analytics: ​199 KB GZIPFirst meaningful paint: 150 ms
React withAuthenticator created using create-react-app with entire library: 816 KB GZIP (includes React.js)First meaningful paint: 280Â ms
React withAuthenticator created using create-react-app with only Auth and Interactions: 481 KB GZIP (includes React.js)First meaningful paint: 240Â ms
Conclusion
As the AWS Amplify team continues iterating on & improving the library, we’ll also always be looking for ways to make the library faster & smaller. If you have any suggestions or comments, please feel free to submit an issue!
To learn more about modular imports in AWS Amplify, click here.
Modular imports with AWS Amplify was originally published in Hacker Noon on Medium, where people are continuing the conversation by highlighting and responding to this story.
Disclaimer
The views and opinions expressed in this article are solely those of the authors and do not reflect the views of Bitcoin Insider. Every investment and trading move involves risk - this is especially true for cryptocurrencies given their volatility. We strongly advise our readers to conduct their own research when making a decision.