Webpacker: Question: Why did yarn was chosen instead of npm?

Created on 9 Jul 2018  路  6Comments  路  Source: rails/webpacker

I just wanted to know the rationale behind the decision.
npm is the default of the javascript community. I am curious why webpacker insist on using yarn.

Most helpful comment

It's pretty straight forwards to make webpacker play nice with npm.

There is a nice guide here:
https://itnext.io/how-to-use-webpacker-with-npm-instead-of-yarn-a8a764e3a8ab

However I do agree that out of the box support for npm or, just moving to npm now that it has caught itself up would be much preferable.

All 6 comments

This is not a Webpacker decision, but a Rails one. Yarn is the JS package manager integrated with Rails so Webpacker uses it.
I was not involved in this, but iirc when the decision was made, npm was really lacking behind yarn, both in term of perf and feature (lockfile for example)

Yarn is directly supported since Rails 5.1, but more importantly, dhh likes it so..

More info: http://g3ortega.com/rails/2017/05/30/rails-5-1-and-forward-yarn-on-rails.html

Thanks for the info.
Rails is starting to move slowly IMO.
There is a lot of legacy stuff and difficult-to-update components.

I'm going to ditch both yarn and webpacker all together for future projects.

Just npm and webpack (the node module, not this gem) would generate fewer hassle these days. With a little Ruby code, we are able to glue everything together nicely. (See assets-webpack-plugin as a starting point for the integration.)

Thanks a lot, everyone who made the webpacker possible. It was a good ride.

It's pretty straight forwards to make webpacker play nice with npm.

There is a nice guide here:
https://itnext.io/how-to-use-webpacker-with-npm-instead-of-yarn-a8a764e3a8ab

However I do agree that out of the box support for npm or, just moving to npm now that it has caught itself up would be much preferable.

Hi all, based on this comment in this article as well as this comment in a separate issue, it is no longer trivially possible to move to npm.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

suhomozgy-andrey picture suhomozgy-andrey  路  3Comments

pioz picture pioz  路  3Comments

swrobel picture swrobel  路  3Comments

amandapouget picture amandapouget  路  3Comments

johan-smits picture johan-smits  路  3Comments