question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Lost in documentation which libraries we should use aws-amplify vs @aws-amplify

See original GitHub issue

Before creating a new issue, please confirm:

On which framework/platform are you having an issue?

React

Which UI component?

Other

How is your app built?

CRA

What browsers are you seeing the problem on?

No response

Please describe your bug.

I’m lost in the documentation on which amplify libraries I should use. How I understand https://github.com/aws-amplify/amplify-js/wiki/Amplify-Modularization is that you have aws-amplify which contains all the packages and then @aws-amplify/<package> which gives you access to a part of the amplify library. So that your bundle size is reduced.

I tried reading a lot of documentation to understand what the best practices are and it seems that doing @aws-amplify/<package> is the way to go. BUT than if you want to use @aws-amplify/ui-react the first install statement is: yarn add @aws-amplify/ui-react aws-amplify

And the ui-react library is indeed depending on aws-amplify. So does that mean we always have to include the whole library and cannot use a smaller portion of the amplify libs.

Would be nice if someone could clarify this for me. As some people (like first comment on https://github.com/aws-amplify/amplify-js/issues/8333) say you should not mix @aws-amplify/<package> with aws-amplify. Or does that exclude @aws-amplify/ui-react ?

What’s the expected behaviour?

Clear documentation which is understandable.

Help us reproduce the bug!

Not completely sure this is actually a bug but I also could not find a better place to raise this issue.

Code Snippet

// Put your code below this line.

Additional information and screenshots

No response

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:8 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
chrisbonifaciocommented, Oct 14, 2022

@abdallahshaban557 Assuming that my understanding is correct (see my last message) than I’m fine to close this issue.

Your understanding is correct, but what I meant was that you can have

Package.json "@aws-amplify/ui-react": "^3.5.1", "aws-amplify": "^4.3.20"

and still import the scoped packages like so:

import { Auth } from '@aws-amplify/auth';
import { Storage } from `@aws-amplify/storage`;

if you wanted or needed to 😃

1reaction
chrisbonifaciocommented, Oct 10, 2022

To expand a little on what @cwomack mentioned about tree shaking, if you have the aws-amplify package installed you can still import only the scoped packages wherever you need them in your application code.

Read more comments on GitHub >

github_iconTop Results From Across the Web

AWS Amplify FAQs | Front-End Web & Mobile
Get answers to frequently asked questions about AWS Amplify on topics like supported languages and frameworks, AWS services, and static web hosting.
Read more >
Announcing the General Availability of AWS Amplify Studio
Amplify Studio extends this ease of configuration to front-end developers, who can use it to work with prebuilt and custom rich user interface...
Read more >
Deploy server-side rendered apps with Amplify Hosting
You can use AWS Amplify to deploy and host web apps that use server-side rendering (SSR). Currently, Amplify Hosting supports apps created using...
Read more >
AWS Amplify Documentation
The Amplify Framework is a comprehensive set of SDKs, libraries, tools, and documentation for client app development. Amplify provides a continuous delivery  ......
Read more >
Using the AWS Amplify JavaScript Library
AWS Amplify is an open source JavaScript library for web and mobile developers who build cloud-enabled applications. AWS Amplify provides customizable UI ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found