Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reduced Rails comfort when switching git branches #2506

Closed
schmijos opened this issue Mar 24, 2020 · 4 comments
Closed

Reduced Rails comfort when switching git branches #2506

schmijos opened this issue Mar 24, 2020 · 4 comments
Labels
dependencies dependency, yarn or other package management

Comments

@schmijos
Copy link

schmijos commented Mar 24, 2020

I switch my git branches like a brisk bird. I work on a feature, then check out a remote change and then switch back to the master.

Since we got Webpacker in Rails, my life became less comfortable: while switching branches works well with Ruby gems (because you can have multiple versions installed and dependency resolution is fast), it doesn't with node packages. I encounter the following message way too often when running rails s:

========================================
  Your Yarn packages are out of date!
  Please run `yarn install --check-files` to update.
========================================

#1135 makes it even worse.

Rails should not annoy me because of Webpacker. Can we do something about that?
A naive idea would be to make separate node_modules folders for each yarn.lock.

Are there any other (more feasible) ideas?

@skipkayhil
Copy link
Member

I think this is one of the places that Yarn 2 (specifically PnP #2112) would be very beneficial. It would remove the need for a node_modules folder and module resolution would happen on the fly so re-installs should not be necessary.

@jakeNiemiec
Copy link
Member

while switching branches works well with Ruby gems (because you can have multiple versions installed and dependency resolution is fast), it doesn't with node packages.

Do you have your yarn.lock file under version control?

@jakeNiemiec jakeNiemiec added the dependencies dependency, yarn or other package management label May 1, 2020
@rossta
Copy link
Member

rossta commented May 14, 2020

I don’t think this is a problem Webpacker should solve. This is an issue for any yarn- or npm-managed project: you have to run yarn install each time you switch branches. This can be handled with a git hook https://andy-carter.com/blog/automating-npm-and-composer-with-git-hooks

@guillaumebriday
Copy link
Member

I think this has been removed in 09caeed

thanks @rossta

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
dependencies dependency, yarn or other package management
Projects
None yet
Development

No branches or pull requests

6 participants
@rossta @schmijos @skipkayhil @guillaumebriday @jakeNiemiec and others