Skip to content
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

Graphql library included even if you don't want to use graphql #701

Closed
shark404 opened this issue Apr 20, 2018 · 8 comments
Closed

Graphql library included even if you don't want to use graphql #701

shark404 opened this issue Apr 20, 2018 · 8 comments
Labels
Build Related to build issues

Comments

@shark404
Copy link

Do you want to request a feature or report a bug?

I guess you could say it's an optimisation feature request.

What is the current behavior?

Since v0.3.0 with the introduction of graphql in the API module the graphql library is forced upon users of the Amplify library even if you're not using the graphql functionality. This is a ~140kb library so the affect on a webapp bundle size is actually quite large.

What is the expected behavior?

Ideally the imports of graphql should be done in a way that webpack can remove them during treeshaking. I'm not sure the best approach here but happy to help on the implementation side of things if someone has some ideas on how to approach it.

@richardzcode
Copy link
Contributor

Hi @shark404 this is a very valid request. Modularized Amplify is in our plan. We are exploring approaches right now, not just graphql but also all categories.

@mlabieniec mlabieniec added the Build Related to build issues label Apr 20, 2018
@mlabieniec mlabieniec added this to the aws-amplify@0.4 milestone Apr 20, 2018
@ishtiaque23
Copy link

ishtiaque23 commented May 6, 2018

Modularizing Amplify sounds like an wonderful idea. I have a project built with Create React App(not ejected yet) and using aws-amplify in it. The unnecessary dependencies actually added 352 kb to my code. I am using version 0.2.14 . I tried the latest version 0.3.3 but it actually increased the bundle size more. My problem goes up a notch as my project already import/use AWS SDK for S3, SES and SNS support. So I kind of have 2 copies of AWS-SDK being added to my app build. Can anyone suggest a quick workaround until the Moduler version get released? Note: I use amplify for Auth purpose only.

@manueliglesias
Copy link
Contributor

Hi @ishtiaque23

As a quick workaround you can try depending on the same aws-sdk version that the aws-amplify version is using, that would be aws-sdk@2.198.0

https://github.com/aws/aws-amplify/blob/aws-amplify%400.2.14/packages/aws-amplify/package.json#L61

@mlabieniec mlabieniec removed this from the aws-amplify@0.4 milestone Jul 19, 2018
@nihakue
Copy link

nihakue commented Aug 2, 2018

Hi, is there an update on this?

@jordanranz
Copy link
Contributor

Modular imports for Amplify has been implemented as part of v1.0. See docs here:
https://aws-amplify.github.io/amplify-js/media/api_guide#using-modularized-module

Going to close this issue as the release of modular Amplify seems to solve the issue here. Please reopen if there are any more related questions or concerns.

@mordka
Copy link
Contributor

mordka commented Apr 9, 2019

Modular imports doesn't resolve this isue. graphl is a direct dependency on @aws-amplify/api
https://github.com/aws-amplify/amplify-js/blob/master/packages/api/package.json#L58

@nihakue
Copy link

nihakue commented Apr 9, 2019 via email

@github-actions
Copy link

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 *-help channels or Discussions for those types of questions.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jun 12, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Build Related to build issues
Projects
None yet
Development

No branches or pull requests

9 participants