Skip to content

Commit

Permalink
Fix install commands for different yarn versions
Browse files Browse the repository at this point in the history
The install command given for Yarn Classic only works for Yarn Berry. The command given for Yarn Berry works, but only due to backward compatibility.
  • Loading branch information
alexeyr-ci authored Nov 21, 2024
1 parent f829152 commit 3d1caae
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions docs/v8_upgrade.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,7 @@ If your host might differ, between various environments for example, you will ei
- Ensure the assets are specifically rebuilt for each environment (Heroku pipeline promote feature for example does not do that by default).
- Make sure the assets are compiled with `SHAKAPACKER_ASSET_HOST=''` ENV variable to avoid hardcording URLs in packs output.

Second option has got a certain gotcha - dynamic imports and static asset references (like image paths in CSS) will end up without host reference and the app will try and fetch them from your app host rather than defined `config.asset_host`.

Make sure the assets are compiled with `SHAKAPACKER_ASSET_HOST=''` ENV variable to avoid hardcoding URLs in packs output.
The second option has got a certain gotcha - dynamic imports and static asset references (like image paths in CSS) will end up without a host reference and the app will try and fetch them from your app host rather than defined `config.asset_host`.

To get around that, you can use dynamic override as outlined by [Webpack documentation](https://webpack.js.org/guides/asset-modules/#on-the-fly-override).

Expand Down Expand Up @@ -102,10 +100,10 @@ namespace :assets do
raise if File.exist?("package.json") && !(system "npm ci")

# yarn v1.x (classic)
raise if File.exist?("package.json") && !(system "yarn install --immutable")
raise if File.exist?("package.json") && !(system "yarn install --frozen-lockfile")

# yarn v2+ (berry)
raise if File.exist?("package.json") && !(system "yarn install --frozen-lockfile")
raise if File.exist?("package.json") && !(system "yarn install --immutable")

# bun v1+
raise if File.exist?("package.json") && !(system "bun install --frozen-lockfile")
Expand Down

0 comments on commit 3d1caae

Please sign in to comment.