Skip to content

Expand the size analysis cli to support bundle size analysis #3873

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

Merged
merged 23 commits into from
Oct 19, 2020
Merged

Conversation

Feiyang1
Copy link
Member

@Feiyang1 Feiyang1 commented Sep 30, 2020

Added a bundle command to the size analysis tool. It takes an array of bundle definitions (basically imports from packages) and analyze their size using either rollup, webpack or both.

As opposed to analyzing the size of each individual exports from a module, this command is useful for analyzing the size of a combination of exports from different modules.

Sample bundle definition file:

[
    {
        "name": "test",
        "dependencies": [
            {
                "packageName": "@firebase/app",
                "versionOrTag": "exp",
                "imports": [
                    "initializeApp"
                ]
            },
            {
                "packageName": "@firebase/firestore",
                "versionOrTag": "exp",
                "imports": [
                    "getFirestore",
                    "doc",
                    "getDoc"
                ]
            }
        ]
    }
] 

Run command on this file:
yarn sa bundle -i repo-scripts/size-analysis/bundle-definition-examples/bundle-definition-1.json -o res -b both

output:

[
  {
    "name": "test",
    "results": [
      {
        "bundler": "rollup",
        "size": 148098,
        "gzipSize": 48871
      },
      {
        "bundler": "webpack",
        "size": 192989,
        "gzipSize": 62322
      }
    ]
  }
]

@changeset-bot
Copy link

changeset-bot bot commented Sep 30, 2020

⚠️ No Changeset found

Latest commit: 212b0f5

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@google-oss-bot
Copy link
Contributor

google-oss-bot commented Sep 30, 2020

Binary Size Report

Affected SDKs

  • @firebase/util

    Type Base (49378bf) Head (3d9d8f9) Diff
    browser 21.0 kB 21.2 kB +279 B (+1.3%)
    esm2017 18.6 kB 18.9 kB +269 B (+1.4%)
    main 21.0 kB 21.3 kB +279 B (+1.3%)
    module 19.9 kB 20.1 kB +263 B (+1.3%)

Test Logs

@google-oss-bot
Copy link
Contributor

google-oss-bot commented Sep 30, 2020

Size Analysis Report

Affected Products

No changes between base commit (49378bf) and head commit (3d9d8f9).

Test Logs

@Feiyang1 Feiyang1 changed the title [WIP] Expand the size analysis cli to support bundle size analysis Expand the size analysis cli to support bundle size analysis Oct 1, 2020
@Feiyang1 Feiyang1 merged commit b6a9bf0 into master Oct 19, 2020
@Feiyang1 Feiyang1 deleted the fei-sa branch October 19, 2020 23:42
@firebase firebase locked and limited conversation to collaborators Nov 19, 2020
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.

3 participants