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

build: shrink size of bundle #576

Merged
merged 3 commits into from
Nov 26, 2024
Merged

build: shrink size of bundle #576

merged 3 commits into from
Nov 26, 2024

Conversation

JoshuaKGoldberg
Copy link
Owner

@JoshuaKGoldberg JoshuaKGoldberg commented Nov 24, 2024

PR Checklist

Overview

Edit: see later comments.

Turns off the ESBuild bundling that was done with tsup. It was including packages from node_modules/. 😩

Running du -sh lib/:

  • Baseline (main): 1.1M
  • With this change: 184K

❤️‍🔥

@ArnaudBarre
Copy link

I don't have full context, but esbuild have a somewhat recent packages option to make all node modules external without the need to specify them: https://esbuild.github.io/api/#packages

Maybe this can lead to better tradeoff for publishing than disabling completely bundling

@RebeccaStevens
Copy link
Collaborator

This change atm is broken. The bundle is tiny because there is no code.

The reason the bundle is so big is because we are shipping source maps. If we remove them, things will be a lot smaller - a saving of about ~700 kB.

The only node dependency being bundled currently is semver - which we shouldn't be doing. I'll fix this up, which will give us another saving.

@JoshuaKGoldberg
Copy link
Owner Author

broken

D'oh! Thanks, yes please. I haven't investigated much beyond the initial size check.

source maps

Relevant: typescript-eslint/typescript-eslint#9352. I'm 👍 on removing them.

@JoshuaKGoldberg JoshuaKGoldberg marked this pull request as draft November 25, 2024 03:05
@RebeccaStevens RebeccaStevens force-pushed the disable-tsup-bundle branch 2 times, most recently from f1eab7e to 38b9149 Compare November 25, 2024 03:08
@RebeccaStevens
Copy link
Collaborator

Bundle size is now down to about 360 kB, half of that being types. Also we're releasing both esm and cjs so the actually size of the runtime import is only about 80 kB.

@RebeccaStevens RebeccaStevens changed the title fix!: disable tsup bundling build: shrink size of bundle Nov 25, 2024
@RebeccaStevens RebeccaStevens marked this pull request as ready for review November 25, 2024 03:21
@RebeccaStevens
Copy link
Collaborator

@JoshuaKGoldberg should be all good now.

Copy link
Owner Author

@JoshuaKGoldberg JoshuaKGoldberg left a comment

Choose a reason for hiding this comment

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

Awesome!

@fisker
Copy link
Contributor

fisker commented Nov 25, 2024

Hi, I didn't see this one when I send #587, do you think replace semver with isTsVersionAtLeast is better approach?

@JoshuaKGoldberg
Copy link
Owner Author

Hi, I didn't see this one when I send #587, do you think replace semver with isTsVersionAtLeast is better approach?

I like it! Filed #589.

Copy link
Owner Author

@JoshuaKGoldberg JoshuaKGoldberg left a comment

Choose a reason for hiding this comment

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

Since GitHub still won't let me approve my own PR (sigh), using this in lieu of an approval.

@RebeccaStevens I'm ready to merge all these PRs in together -hopefully including #587?- and get a full 2.0 release if you're happy!

@RebeccaStevens RebeccaStevens enabled auto-merge (squash) November 26, 2024 04:22
@RebeccaStevens RebeccaStevens merged commit 3c06f35 into main Nov 26, 2024
20 checks passed
@RebeccaStevens RebeccaStevens deleted the disable-tsup-bundle branch November 26, 2024 04:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

🐛 Bug: Package size is a whopping 1.2MB
4 participants