Skip to content

perf: minify the generated bundle by default #714

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
Jun 6, 2025
Merged

perf: minify the generated bundle by default #714

merged 2 commits into from
Jun 6, 2025

Conversation

vicb
Copy link
Contributor

@vicb vicb commented Jun 6, 2025

Turns on minifying by default as bundle size could have an impact on performance.

This PR stays on the safe side by only minifying whitespaces and syntax. Identifier are explicitly not renamed to avoid runtime issues.

Some result experimenting with a sample app.

The original code size was 7.7MB before bundling.

Before this PR, the output would be 10.2MB
Using the most agressive minification (minify: true) -> 6.7MB
Using the safe minification implemented in this PR -> 7.4MB

That a close to 30% improvement.

Copy link

changeset-bot bot commented Jun 6, 2025

⚠️ No Changeset found

Latest commit: 3b31ba5

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

Copy link

pkg-pr-new bot commented Jun 6, 2025

Open in StackBlitz

npm i https://pkg.pr.new/@opennextjs/cloudflare@714

commit: 75c6794

@vicb vicb requested review from james-elicx, dario-piotrowicz and conico974 and removed request for james-elicx June 6, 2025 11:49
@vicb
Copy link
Contributor Author

vicb commented Jun 6, 2025

Thanks Nico!

@vicb vicb merged commit eedbe2b into main Jun 6, 2025
7 checks passed
@vicb vicb deleted the vicb/minify branch June 6, 2025 12:05
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.

2 participants