Why do you use pnpm or bun?

Vaadin supports three different JavaScript package managers: npm, pnpm and bun. I’m evaluating what this might look like in the future:

  • Are the three options distinct enough to justify supporting all of them in parallel? Every minute we spend investigating or fixing any issue specific to one of the package managers is a minute not spent on making other improvements.
  • Would Vaadin users in general benefit from having a different default? How much better would an alternative have to be to justify elevating it over the established de-factor standard?

It’s expected that everyone would prefer that the option that they’re happy with would remain supported and chosen as the default so that’s not something I will ask about.

Instead, the question mainly goes out to those Vaadin users who have chosen to use pnpm or bun: what made you make that choice? Do you think you would stick to that choice if you would start over from scratch today?

Also, if you’re using npm not only because it’s the default but you actually made an active choice based on thorough evaluation, then what factors contributed to that choice?

A little bit of historical context

Npm is the de-facto standard among JavaScript developers in general and also the default option with Vaadin.

We introduced pnpm as the default choice in 2019 because it was significantly faster and had some essential features that were missing from npm. Development of npm subsequently caught up with regards to those essential features. While there’s still a difference in performance, the gap is not as big as it was a couple of years earlier. Based on this, npm was reinstated as the default choice in Vaadin in 2021 and has remained in that position since then.

Finally, support for bun was added in 2023 based on the buzz around it when it was launched.

A a pure Flow you user I do not care what is I used. I assume the default is the best choice

4 Likes

Looking at the documentation it seems I would benefit from bun, because the node_modules directory with its 23K files pisses me off; It takes so long to delete. It sounds like bun solves this?

However, I also don’t want to think about it ever, so as long as I have to get all developers to install it, and set up the jenkins server, bun is a non-starter

1 Like

Why do you even have a node_modules directory?
I never do a production build locally. This happens in the pipeline.

I do production builds locally, because dev mode doesn’t work for us.
Then I check in prod.bundle for the other developers to use.

I never had problems with the dev mode. What’s your issue? Why doesn’t it work for you?

Our structure is a classical ear with:

  • lib with shared dependencies (skinnywar)
  • war1
  • war2
  • war3 …
  • widgetset jar, shared by the wars

Vaadin dev mode will try to initialize itself for each of the wars that use vaadin and fail because the initialization is run in parallel. It will also fail because it assumes there is one source directory.

Frankly, I’m fine with not using dev mode, since it doesn’t bring enough value for us.

  • We generate all our layouts, so don’t need a designer.
  • We place css and other resources where they belong, in src\main\webapp, so don’t need the “frontend” magic
  • Automatic reload when code changes seems like a poor idea, and if I want it I can press F5.