Skip to content

Migrate build from rollup to rolldown#10011

Draft
simon04 wants to merge 1 commit into
Leaflet:mainfrom
simon04:rolldown
Draft

Migrate build from rollup to rolldown#10011
simon04 wants to merge 1 commit into
Leaflet:mainfrom
simon04:rolldown

Conversation

@simon04

@simon04 simon04 commented Dec 8, 2025

Copy link
Copy Markdown
Contributor

Comment thread src/Leaflet.js Outdated
@simon04

simon04 commented Dec 9, 2025

Copy link
Copy Markdown
Contributor Author

Here's how the bundle sizes change:

# rollup
> /usr/bin/ls -l dist/*.js
-rw-r--r-- 1 simon simon 137005 2025-12-09 07:43 dist/leaflet-global.js
-rw-r--r-- 1 simon simon 411403 2025-12-09 07:43 dist/leaflet-global-src.js
-rw-r--r-- 1 simon simon 144988 2025-12-09 07:43 dist/leaflet.js
-rw-r--r-- 1 simon simon 398799 2025-12-09 07:43 dist/leaflet-src.js

# rolldown removes the comments from the source files
-rw-r--r-- 1 simon simon 139276 2025-12-09 07:44 dist/leaflet-global.js
-rw-r--r-- 1 simon simon 223422 2025-12-09 07:44 dist/leaflet-global-src.js
-rw-r--r-- 1 simon simon 138690 2025-12-09 07:44 dist/leaflet.js
-rw-r--r-- 1 simon simon 215264 2025-12-09 07:44 dist/leaflet-src.js

Comment thread build/rollup-config.js Outdated
Comment thread build/rollup-config.js Outdated
Comment thread build/rollup-config.js Outdated
Comment thread build/rollup-config.js Outdated
Comment thread build/rollup-config.js Outdated
Comment thread package.json Outdated
Comment thread package.json Outdated
Comment thread build/rollup-config.js Outdated
Comment thread build/rollup-config.js Outdated
Comment thread build/rollup-config.js Outdated
@jonkoops

jonkoops commented Dec 9, 2025

Copy link
Copy Markdown
Collaborator

I am a big supporter of using Rolldown, it is much faster! Couple of notes though:

  • I am seeing some validation errors when running the build.
  • Assets are emitted multiple times.

Comment thread .github/workflows/main.yml Outdated
Comment thread build/rollup-config.js Outdated
Comment thread build/rollup-config.js Outdated
Comment thread src/Leaflet.js
@jonkoops

Copy link
Copy Markdown
Collaborator

@simon04 I'm going to do a quick squash and add some of the discussed changes so we can get this merged in.

@simon04

This comment was marked as off-topic.

@jonkoops

This comment was marked as off-topic.

@simon04

This comment was marked as off-topic.

@jonkoops

This comment was marked as off-topic.

@simon04

This comment was marked as off-topic.

@jonkoops

jonkoops commented Dec 24, 2025

Copy link
Copy Markdown
Collaborator

So I have been doing some digging, and it seems that the bundle that is currently emitted by Rollup (on main) as well as the one emitted here by Rolldown, do not work properly for UMD setups. I'm going to raise a PR to fix this on main first, and then we'll see how we can adapt this to Rolldown.

@jonkoops

Copy link
Copy Markdown
Collaborator

@simon04 I had to do some fixes to the original Rollup build (see #10027, #10028, #10029) to make sure all the various distributions work correctly. It looks like Rolldown might not support all the options required to make this work (yet), specifically the noConflict and amd.id options, so I am marking this PR as draft for now until these are implemented. Perhaps you could take a look at logging some issues in the Rollup project to add support for these options, or perhaps even fix them?

Even without Rolldown, I think this PR has some valuable additions, so I will be splitting the chunks of the work you have done here into separate PRs that we can land individually.

@jonkoops jonkoops marked this pull request as draft December 29, 2025 13:20
@jonkoops

jonkoops commented Dec 29, 2025

Copy link
Copy Markdown
Collaborator

@IvanSanchez I've removed rollup-plugin-git-version under 1b3875f (accidentally pushed to main, set up a branch protection rule to prevent that from happening again). Since we're using the script @Falke-Design wrote to set the version under #9717, we are no longer importing the package.json, and thus this plugin never did anything since.

You might want to deprecate rollup-plugin-git-version since AFAIK we were the only users.

Co-authored-by: Simon Legner <Simon.Legner@gmail.com>
@jonkoops

Copy link
Copy Markdown
Collaborator

@simon04 I have split out the work you did here, and some other enhancements into separate PRs that have landed on main (see #10027, #10028, #10029, #10037, #10038, 1b3875f, #10041, #10042), that are all applied to the existing Rollup build. I have rebased this PR so the only work left is now purely the migration from Rollup to Rolldown.

Looking at the final build, it seems that Rolldown is missing several features that would have to be implemented in order for this PR to be merged, namely:

  • The freeze option is not supported, meaning the exports of the ESM build are mutable.
  • The amd.id option is not supported, meaning the AMD distribution doesn't work (see test/debug/dist-amd.html).
  • The noConflict option is not supported, meaning the noConflict() method is not added to the namespace for the UMD distribition.

@jonkoops jonkoops added this to the After 2.0 milestone Dec 31, 2025
@simon04

simon04 commented Dec 31, 2025

Copy link
Copy Markdown
Contributor Author

Hi @jonkoops, amazing, thank you for your work. Considering that builds are performed only so often, and that the rollup build is sufficiently fast (914ms on an Intel i5-14600K), I think we can de-prioritize the migration to rolldown.

@jonkoops

Copy link
Copy Markdown
Collaborator

Agreed, it would still be nice to move in the future once these features are implemented. I believe the goal is to be fully Rollup compatible in the long run, so it should 'just work' in the long run. It would be nice if someone could report these compatibility issues on their repo, and add them here for tracking. I am currently too tied down on other stuff to do so 😉

@simon04

simon04 commented Dec 31, 2025

Copy link
Copy Markdown
Contributor Author

I've submitted the following upstream feature requests:

@jonkoops

Copy link
Copy Markdown
Collaborator

Appreciate it!

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.

4 participants