Skip to content

Amplify bundle seems exsessively large #14609

@gmzacharydovel

Description

@gmzacharydovel

Before opening, please confirm:

JavaScript Framework

Not applicable

Amplify APIs

Authentication

Amplify Version

v6

Amplify Categories

No response

Backend

None

Environment information

I'm using Deno/esbuild/webpack for repro.

Describe the bug

The size of amplify seems excessive when you aren't using the UI. Usually this is a hint that barrel exports are happening including a lot of unneeded stuff (regardless of tree shaking)

With Webpack I am seeing 120KB versus 176KB on output sizes when doing static imports versus dynamic imports.

With esbuild it is 135KB versus 169KB on output sizes for static versus dynamic.

I'm seeing it going down to about 40KB gzipped/broccoli over the network.

Image Image

Expected behavior

I would hope that amplify isn't double the size of my initial loaded bundle being just an auth library and where I am not even using the UI parts. Importing only:

import { Amplify } from "aws-amplify";
import {
  confirmSignUp,
  resetPassword,
  signOut,
  signUp,
} from "aws-amplify/auth";

console.log(Amplify);
console.log({ confirmSignUp, resetPassword, signOut, signUp });

the size of my bundles will be double the size. Only importing this is 135.5kb

Reproduction steps

aws-amplify-size-repro.zip

I've included an example repro.

  1. Install deno -> https://deno.com/
  2. deno install
  3. deno task webpack (to build with webpack to see the outputs in the build directory)
  4. deno task esbuild (to build with esbuild to see the outputs in the build directory)

Code Snippet

No response

Log output

// Put your logs below this line


aws-exports.js

No response

Manual configuration

No response

Additional configuration

No response

Mobile Device

No response

Mobile Operating System

No response

Mobile Browser

No response

Mobile Browser Version

No response

Additional information and screenshots

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions