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

Support jsbundling-rails (Rails 7): Yarn appears to only be available alongside Webpacker #1202

Closed
dwightwatson opened this issue Sep 22, 2021 · 1 comment

Comments

@dwightwatson
Copy link

I'm experimenting with a Rails 7.x alpha app on Heroku, which now provides an alternative to Webpacker call jsbundling-rails. These bundlers effectively run externally of Rails and inject their builds into the regular old asset pipeline.

They still expect yarn to be available to install and build, but it appears as though yarn may not be available if Webpacker isn't detected.

-----> Preparing app for Rails asset pipeline
       Running: rake assets:precompile
       sh: 1: yarn: not found
       sh: 1: yarn: not found
       Asset precompilation completed (1.52s)
       Cleaning assets
       Running: rake assets:clean

The easy solution is to add the heroku/nodejs buildpack and then it'll build fine. But if the ruby buildpack already includes support for yarn perhaps it should always be available, or better at detecting when it's required. Perhaps the presence of a package.json or yarn.lock should be a good enough hint to make it available?

@schneems
Copy link
Contributor

Thanks for the report. In the past we've gated based on the presence of certain gems, currently, we gate on webpacker and execjs.

Perhaps the presence of a package.json or yarn.lock should be a good enough hint to make it available

That seems much less piecemeal. I've added a card to work on this. We're in the middle of a deploy freeze due to dreamforce but that's over at the end of the week.

@schneems schneems changed the title Yarn appears to only be available alongside Webpacker Support jsbundling-rails (Rails 7): Yarn appears to only be available alongside Webpacker Oct 13, 2021
schneems added a commit that referenced this issue Oct 13, 2021
Rails 7 introduced the gem:

```
gem "jsbundling-rails", "~> 0.1.0"
```

Which no longer relies on `webpacker`. 

Issue #1202 was opened since developers using jsbundling would expect `yarn` to be available but won't have the `webpacker` gem which we use to gate detection for yarn installation.

With this change we now install nodejs when a `package.json` is detected and yarn when `yarn.lock` is detected.
schneems added a commit that referenced this issue Oct 13, 2021
Rails 7 introduced the gem:

```
gem "jsbundling-rails", "~> 0.1.0"
```

Which no longer relies on `webpacker`. 

Issue #1202 was opened since developers using jsbundling would expect `yarn` to be available but won't have the `webpacker` gem which we use to gate detection for yarn installation.

With this change we now install nodejs when a `package.json` is detected and yarn when `yarn.lock` is detected.
leshik pushed a commit to leshik/heroku-buildpack-ruby that referenced this issue Oct 14, 2021
Rails 7 introduced the gem:

```
gem "jsbundling-rails", "~> 0.1.0"
```

Which no longer relies on `webpacker`.

Issue heroku#1202 was opened since developers using jsbundling would expect `yarn` to be available but won't have the `webpacker` gem which we use to gate detection for yarn installation.

With this change we now install nodejs when a `package.json` is detected and yarn when `yarn.lock` is detected.
schneems added a commit that referenced this issue Oct 19, 2021
Rails 7 introduced the gem:

```
gem "jsbundling-rails", "~> 0.1.0"
```

Which no longer relies on `webpacker`. 

Issue #1202 was opened since developers using jsbundling would expect `yarn` to be available but won't have the `webpacker` gem which we use to gate detection for yarn installation.

With this change we now install nodejs when a `package.json` is detected and yarn when `yarn.lock` is detected.
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

No branches or pull requests

2 participants