Skip to content

Conversation

@manueliglesias
Copy link
Contributor

Issue #, if available:
Related to #6844

Description of changes:
This PR adds files that call Amplify.configure() to the "sideEffects" key in package.json.

The purpose of this is to hint bundlers to not remove the categories registration when creating the bundle.

Tests were done with an angular 9 application in production mode using @aws-amplify/auth

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

@codecov
Copy link

codecov bot commented Sep 24, 2020

Codecov Report

Merging #6867 into main will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@           Coverage Diff           @@
##             main    #6867   +/-   ##
=======================================
  Coverage   73.34%   73.34%           
=======================================
  Files         212      212           
  Lines       13146    13146           
  Branches     2470     2566   +96     
=======================================
  Hits         9642     9642           
+ Misses       3340     3310   -30     
- Partials      164      194   +30     
Impacted Files Coverage Δ
packages/auth/src/OAuth/OAuth.ts 56.11% <0.00%> (ø)
packages/core/src/Credentials.ts 31.51% <0.00%> (ø)
packages/analytics/src/Analytics.ts 63.58% <0.00%> (ø)
packages/datastore/src/sync/index.ts 15.41% <0.00%> (ø)
packages/datastore/src/sync/outbox.ts 24.00% <0.00%> (ø)
packages/datastore/src/storage/storage.ts 71.66% <0.00%> (ø)
packages/core/src/OAuthHelper/GoogleOAuth.ts 33.33% <0.00%> (ø)
packages/core/src/Util/Reachability.native.ts 37.50% <0.00%> (ø)
packages/xr/src/Providers/SumerianProvider.ts 47.55% <0.00%> (ø)
packages/core/src/OAuthHelper/FacebookOAuth.ts 34.69% <0.00%> (ø)
... and 8 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 7cbed47...02bf34d. Read the comment docs.

@ericclemmons
Copy link
Contributor

ericclemmons commented Sep 24, 2020

https://github.com/aws-amplify/amplify-js-samples-staging/tree/master/samples/next/auth/ssr-auth

unstable

Page                                                           Size     First Load JS
┌ λ /                                                          85.4 kB         188 kB
├   /_app                                                      0 B             103 kB
├ ○ /404                                                       2.75 kB         105 kB
├ λ /api/create-todo                                           0 B             103 kB
├ λ /api/profile                                               0 B             103 kB
├ λ /api/subscription                                          0 B             103 kB
└ λ /api/todos                                                 0 B             103 kB
+ First Load JS shared by all                                  103 kB
  ├ chunks/commons.cf2481.js                                   45.8 kB
  ├ chunks/f6078781a05fe1bcb0902d23dbbb2662c8d200b3.957259.js  7.86 kB
  ├ chunks/framework.e22d51.js                                 39.9 kB
  ├ chunks/main.3d527d.js                                      6.97 kB
  ├ chunks/pages/_app.e860cb.js                                281 B
  ├ chunks/webpack.26e93e.js                                   1.82 kB
  └ css/3f733c5945f7dd00de2a.css                               3.68 kB

λ  (Lambda)  server-side renders at runtime (uses getInitialProps or getServerSideProps)
○  (Static)  automatically rendered as static HTML (uses no initial props)
●  (SSG)     automatically generated as static HTML + JSON (uses getStaticProps)
   (ISR)     incremental static regeneration (uses revalidate in getStaticProps)

ui-preview (NO CHANGE)

Page                                                           Size     First Load JS
┌ λ /                                                          85.4 kB         188 kB
├   /_app                                                      0 B             103 kB
├ ○ /404                                                       2.75 kB         105 kB
├ λ /api/create-todo                                           0 B             103 kB
├ λ /api/profile                                               0 B             103 kB
├ λ /api/subscription                                          0 B             103 kB
└ λ /api/todos                                                 0 B             103 kB
+ First Load JS shared by all                                  103 kB
  ├ chunks/commons.cf2481.js                                   45.8 kB
  ├ chunks/f6078781a05fe1bcb0902d23dbbb2662c8d200b3.957259.js  7.86 kB
  ├ chunks/framework.e22d51.js                                 39.9 kB
  ├ chunks/main.3d527d.js                                      6.97 kB
  ├ chunks/pages/_app.e860cb.js                                281 B
  ├ chunks/webpack.26e93e.js                                   1.82 kB
  └ css/3f733c5945f7dd00de2a.css                               3.68 kB

λ  (Lambda)  server-side renders at runtime (uses getInitialProps or getServerSideProps)
○  (Static)  automatically rendered as static HTML (uses no initial props)
●  (SSG)     automatically generated as static HTML + JSON (uses getStaticProps)
   (ISR)     incremental static regeneration (uses revalidate in getStaticProps)

https://github.com/aws-amplify/amplify-js-samples-staging/tree/master/samples/react/multi-category/photo-albums-e2e

unstable

$ react-scripts build
Creating an optimized production build...
Compiled successfully.

File sizes after gzip:

  320.93 KB  build/static/js/2.e1158d5f.chunk.js
  95.52 KB   build/static/css/2.5f1adba5.chunk.css
  5.66 KB    build/static/js/main.c3f77aaa.chunk.js
  780 B      build/static/js/runtime-main.96a1bb30.js


ui-preview (+455 B)

$ react-scripts build
Creating an optimized production build...
Compiled successfully.

File sizes after gzip:

  321.37 KB (+450 B)  build/static/js/2.33dd681c.chunk.js
  95.52 KB            build/static/css/2.5f1adba5.chunk.css
  5.67 KB (+5 B)      build/static/js/main.3b3da971.chunk.js
  780 B               build/static/js/runtime-main.96a1bb30.js

Copy link
Contributor

@ericclemmons ericclemmons left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Next.js no changes, CRA +455B.

@ashika01
Copy link
Contributor

ashika01 commented Sep 24, 2020

Testing a predictions and graphql vue sample I have.

Chunks using latest

  File                                 Size                                      Gzipped

  dist/js/chunk-vendors.d80d215c.js    1911.30 KiB                               441.93 KiB
  dist/js/app.5cde9f75.js              11.66 KiB                                 3.59 KiB

  Images and other types of assets omitted.

Chunks using ui-preview

 File                                 Size                                      Gzipped

  dist/js/chunk-vendors.7729bf52.js    1911.26 KiB                               442.06 KiB
  dist/js/app.8129ea9d.js              11.66 KiB                                 3.59 KiB

  Images and other types of assets omitted.

Copy link
Contributor

@ashika01 ashika01 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 🚀

@wlee221
Copy link
Contributor

wlee221 commented Sep 24, 2020

@Amplifiyer's sample app with api, storage, and auth:
unstable -> ui-preview:

  240.3 KB (+55 B)  build/static/js/2.d58d81dc.chunk.js
  3.52 KB           build/static/js/main.0c4bf0ff.chunk.js
  781 B             build/static/js/runtime-main.41234f53.js
  547 B             build/static/css/main.5f361e03.chunk.css

Copy link
Contributor

@sammartinez sammartinez left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 🌮

@wlee221
Copy link
Contributor

wlee221 commented Sep 24, 2020

@aws-amplify/interactions with Angular prod is working fine too. Computing the diff now...

edit: tested on react / vue and they are good 👍 react diff:

  159.85 KB (+153.94 KB)  build/static/js/7.4d4ebaaf.chunk.js
  24.99 KB                build/static/js/38.6d38928d.chunk.js
  24.44 KB (+19.31 KB)    build/static/js/1.3d4ebfd8.chunk.js
  13.99 KB (-188 B)       build/static/js/11.aca720b2.chunk.js
  12.22 KB (+11.39 KB)    build/static/js/33.00b1ea46.chunk.js
  7.73 KB                 build/static/js/2.59b07c73.chunk.js
  7.36 KB (+2.15 KB)      build/static/js/8.64978f06.chunk.js
  6.59 KB (+802 B)        build/static/js/23.1869f8b5.chunk.js
  6.37 KB (-35.25 KB)     build/static/js/0.d5eab261.chunk.js
  6.09 KB (-513 B)        build/static/js/22.b88c270f.chunk.js
  5.81 KB (+3.59 KB)      build/static/js/24.4d37de1c.chunk.js
  5.57 KB (+1.01 KB)      build/static/js/12.ab0d4f78.chunk.js
  5.55 KB (+5.21 KB)      build/static/js/27.17b2e4b8.chunk.js
  5.21 KB (-958 B)        build/static/js/13.a01fd59b.chunk.js
  5.07 KB (+1.61 KB)      build/static/js/17.b603a156.chunk.js
  4.52 KB (+1.33 KB)      build/static/js/14.038af81e.chunk.js
  4.44 KB                 build/static/js/3.d602171f.chunk.js
  4.43 KB (-599 B)        build/static/js/9.a765c66e.chunk.js
  4.33 KB (-511 B)        build/static/js/16.deec0d39.chunk.js
  4.32 KB (+1.62 KB)      build/static/js/15.9024bba2.chunk.js
  3.98 KB (+2.53 KB)      build/static/js/20.b18c3658.chunk.js
  3.93 KB (-1.1 KB)       build/static/js/10.9092792b.chunk.js
  3.87 KB (-2.23 KB)      build/static/js/21.4cfd60ab.chunk.js
  3.71 KB (+276 B)        build/static/js/18.2f011ab9.chunk.js
  3.69 KB (-48 B)         build/static/js/19.e9b15ca6.chunk.js
  3.36 KB (+1 B)          build/static/js/polyfills-css-shim.614f2445.chunk.js
  2.21 KB (+1.73 KB)      build/static/js/25.318f557d.chunk.js
  2.11 KB                 build/static/js/37.dc614758.chunk.js
  1.52 KB (+21 B)         build/static/js/runtime-main.edcd3ebb.js
  1.44 KB (+20 B)         build/static/js/main.acbacf8c.chunk.js
  1.39 KB (+714 B)        build/static/js/34.5602b932.chunk.js
  1.12 KB (+686 B)        build/static/js/30.9a9df9fa.chunk.js
  851 B (-1.28 KB)        build/static/js/35.80b86185.chunk.js
  709 B (-24.3 KB)        build/static/js/36.39162c8a.chunk.js
  659 B (-11.58 KB)       build/static/js/31.05041c81.chunk.js
  642 B (-18 B)           build/static/js/29.3ae5ed34.chunk.js
  493 B (-5.07 KB)        build/static/js/26.fa9359bd.chunk.js
  461 B                   build/static/css/main.1e112585.chunk.css
  459 B (-961 B)          build/static/js/32.2d5f8a61.chunk.js
  347 B (-798 B)          build/static/js/28.cc280ca7.chunk.js

my chatbot samples seem to have larger diffs, but this maybe something on ui-component/chatbot side (as it already has a large bundle size to start with). Let's see what others get first.

Copy link
Contributor

@amhinson amhinson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All good for React Native 👍
No diff bc Metro doesn't support tree shaking.

Copy link
Contributor

@elorzafe elorzafe left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @manueliglesias ! 🥇

@github-actions
Copy link

This pull request 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 Sep 25, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Feedback]Application doesn't work for Angular production builds

7 participants