Skip to content

Replace microbundle with rollup#463

Open
XhmikosR wants to merge 2 commits into
mainfrom
xmr/rollup
Open

Replace microbundle with rollup#463
XhmikosR wants to merge 2 commits into
mainfrom
xmr/rollup

Conversation

@XhmikosR

@XhmikosR XhmikosR commented Dec 6, 2025

Copy link
Copy Markdown
Collaborator

TODO:

  • verify the bundles are 100% what they were functionality-wise
  • decide if we want sourcemaps; main branch doesn't have them
  • tackle copyright comments issue

@XhmikosR XhmikosR force-pushed the xmr/rollup branch 7 times, most recently from 372e7bb to 1bdcc40 Compare December 8, 2025 07:43
@XhmikosR XhmikosR force-pushed the xmr/rollup branch 2 times, most recently from 33d630b to 5dd13c8 Compare May 21, 2026 08:14
@XhmikosR XhmikosR marked this pull request as ready for review May 21, 2026 08:16
@XhmikosR XhmikosR requested a review from addyosmani May 21, 2026 08:16
@XhmikosR

XhmikosR commented May 21, 2026

Copy link
Copy Markdown
Collaborator Author

@addyosmani: WDYT about this PR? microbundle seems unmaintained. I have two TODOs I could use a second pair of eyes/second opinion.

@XhmikosR XhmikosR changed the title Replace microbundle with rollup. Replace microbundle with rollup May 21, 2026
@XhmikosR XhmikosR force-pushed the xmr/rollup branch 2 times, most recently from b608610 to 6f17536 Compare May 23, 2026 18:21
@XhmikosR XhmikosR force-pushed the xmr/rollup branch 2 times, most recently from f2c0577 to 070ad44 Compare June 11, 2026 13:35
@XhmikosR

Copy link
Copy Markdown
Collaborator Author

@addyosmani friendly ping :)

@addyosmani addyosmani left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Thanks for tackling this @XhmikosR -agreed that microbundle being unmaintained makes this worth doing, and the rollup config is clean and well-structured.

I built both main and this branch side-by-side to check TODO #1, and the bundles are functionally equivalent: the core CJS still exports listen/prefetch/prerender, every output file is reproduced with the same name and format, and the only size movement is ~30–70 bytes gzipped on the core bundles (terser vs microbundle defaults), which is exactly what the .size-limit.json bump covers. dist/react/hoc.js is the one notable change - it's now run through terser instead of being emitted unminified by plain babel, so it drops from ~1.6 kB to ~0.6 kB gzipped with identical logic.

On TODO #2: I think we should skip sourcemaps and set sourcemap: false everywhere to match current behavior.

The config currently enables maps on every output, and since we ship files: ["dist"], that publishes them to npm - the unpacked tarball goes from ~70 kB / 12 files to ~249 kB / 21 files (+9 .map files), a ~3.5× jump.

The maps are self-contained so they're harmless functionally, but it's a meaningful weight increase for something nobody's asked for. Shipping sourcemaps is a reasonable thing to do, but I'd rather make it a deliberate, separate decision than fold it into a build-tool swap. Easy to add back later if we want them.

One minor non-blocker: terser's format.comments: false strips the Apache license header from the distributed files (it's currently retained in main's hoc.js). If we care about keeping license attribution in dist, we can add a banner in the rollup config or switch to comments: 'some'. Otherwise this is good to go once the sourcemaps are disabled.

@XhmikosR

Copy link
Copy Markdown
Collaborator Author

Thanks for the review. Only issue left is the comments. I'll try to tackle it later. As for sourcemaps, I thought it'd be better for debugging, but we can enable them later if needed.

@XhmikosR

Copy link
Copy Markdown
Collaborator Author

So, about the comments, previously the react hoc.js was only passing through babel. Now it goes through the whole pipeline like everything else. No other dist file had comments and was already minified.

So, the question is, do we want to keep it like that or like it was before? The current way is admittedly simpler.

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