Skip to content

Minify CDN builds #6525

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 2 commits into from
Aug 12, 2022
Merged

Minify CDN builds #6525

merged 2 commits into from
Aug 12, 2022

Conversation

hsubox76
Copy link
Contributor

The compat CDN builds are minified but the modular ones are not, and it may have been an oversight. Using terser to minify the firebase-*.js files results in files about 1/4 the size they were before minification. We publish sourcemaps so this shouldn't interfere with developers debugging.

The license text is also embedded in the sourcemaps which should hopefully be enough, because otherwise each file contains many repeated versions of the license text which impacts file size considerably. I couldn't find an easy way to dedupe it. (I tried to use the gulp step, which is used to swap in the gstatic firebase-app.js url for "@firebase/app", to also append a license header, but this throws off the source map considerably and makes it unusable.)

@hsubox76 hsubox76 requested a review from dwyfrequency as a code owner August 11, 2022 23:40
@changeset-bot
Copy link

changeset-bot bot commented Aug 11, 2022

⚠️ No Changeset found

Latest commit: 4e92105

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

@github-actions
Copy link
Contributor

github-actions bot commented Aug 11, 2022

Changeset File Check ✅

  • No modified packages are missing from the changeset file.
  • No changeset formatting errors detected.

@google-oss-bot
Copy link
Contributor

google-oss-bot commented Aug 12, 2022

Size Report 1

Affected Products

  • @firebase/database

    TypeBase (ac578e9)Merge (74182c0)Diff
    browser248 kB248 kB-648 B (-0.3%)
    esm5276 kB276 kB-574 B (-0.2%)
    main282 kB281 kB-574 B (-0.2%)
    module248 kB248 kB-648 B (-0.3%)
  • @firebase/database-compat/standalone

    TypeBase (ac578e9)Merge (74182c0)Diff
    main371 kB370 kB-574 B (-0.2%)
  • bundle

    TypeBase (ac578e9)Merge (74182c0)Diff
    database (Listen for child events)160 kB160 kB-230 B (-0.1%)
    database (Listen for value events + Detach listeners)160 kB160 kB-230 B (-0.1%)
    database (Listen for value events)160 kB160 kB-230 B (-0.1%)
    database (Read data once)157 kB159 kB+2.66 kB (+1.7%)
    database (Save data as transactions)162 kB162 kB-230 B (-0.1%)
  • firebase

    17 size changes

    TypeBase (ac578e9)Merge (74182c0)Diff
    firebase-analytics.js115 kB24.9 kB-89.6 kB (-78.2%)
    firebase-app-check.js90.9 kB21.7 kB-69.2 kB (-76.2%)
    firebase-auth-cordova.js472 kB137 kB-335 kB (-70.9%)
    firebase-auth-react-native.js498 kB148 kB-350 kB (-70.2%)
    firebase-auth.js418 kB116 kB-302 kB (-72.2%)
    firebase-compat.js795 kB794 kB-413 B (-0.1%)
    firebase-database-compat.js166 kB166 kB-413 B (-0.2%)
    firebase-database.js606 kB153 kB-453 kB (-74.7%)
    firebase-firestore-lite.js267 kB86.1 kB-181 kB (-67.8%)
    firebase-firestore.js852 kB312 kB-539 kB (-63.3%)
    firebase-functions.js32.0 kB6.93 kB-25.1 kB (-78.4%)
    firebase-installations.js59.6 kB12.5 kB-47.1 kB (-79.0%)
    firebase-messaging-sw.js107 kB26.0 kB-81.4 kB (-75.8%)
    firebase-messaging.js106 kB24.8 kB-81.2 kB (-76.6%)
    firebase-performance.js123 kB30.7 kB-92.6 kB (-75.1%)
    firebase-remote-config.js113 kB26.4 kB-86.4 kB (-76.6%)
    firebase-storage.js146 kB36.7 kB-109 kB (-74.9%)

Test Logs

  1. https://storage.googleapis.com/firebase-sdk-metric-reports/bL8ipzVV3m.html

@google-oss-bot
Copy link
Contributor

google-oss-bot commented Aug 12, 2022

Size Analysis Report 1

This report is too large (88,843 characters) to be displayed here in a GitHub comment. Please use the below link to see the full report on Google Cloud Storage.

Test Logs

  1. https://storage.googleapis.com/firebase-sdk-metric-reports/xZpkuxBYIZ.html

Copy link
Contributor

@dwyfrequency dwyfrequency left a comment

Choose a reason for hiding this comment

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

LGTM

@hsubox76 hsubox76 merged commit 2b2079d into master Aug 12, 2022
@hsubox76 hsubox76 deleted the ch-cdn-minify branch August 12, 2022 22:12
@firebase firebase locked and limited conversation to collaborators Sep 12, 2022
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