[Proposal] In jsbundling-rails, allow npm or pnpm to be used as Node package managers

If I understand correctly, jsbundling-rails uses yarn under the hood and does not provide any options to switch package managers. I’m willing to create a pull request to allow the package manager to be configured if there’s interest in such a feature. Would that be appreciated?

(I also suggested this in this GitHub issue: Allow npm or pnpm to be used as a package manager instead of yarn · Issue #176 · rails/jsbundling-rails · GitHub But afterwards, I saw in the Rails contributor guide that this is the preferred place to ask for feedback on feature requests before starting work on pull requests.)

this is the preferred place to ask for feedback on feature requests before starting work on pull requests

That could probably do with some rephrasing / re-emphasis… I think it sometimes reads as “ask here before working on a PR”, when the intention is more “if you want to ask before you start on a PR, this is the place to do so”.

And while that latter version is true, even that is honestly often pretty difficult in practice, because I feel like the answer is so often something like:

The package management landscape has certainly changed a lot since we picked yarn, so this does seem worth looking in to. (And we’ve arguably already nodded in that direction with the recent Bun support, which offers it as an esbuild alternative, but I think also defers to it for at least some yarn-shaped duties as well.) It’s really going to come down to what the PR looks like, how effectively we can hide the detail from the user, and how much it complicates the implementation.

Please do investigate? :slight_smile:

Thanks for the response, Matthew! I’m busy with a higher-priority project at the moment. But I’ll take a look at this when I have time. I’m hoping to start working on a PR by the end of the year.