Skip to content

Commit ef3377f

Browse files
justin808claude
andcommitted
Fix bundler isolation for generated example apps
Use BUNDLE_GEMFILE to explicitly point to the generated app's Gemfile when running rake tasks. This prevents bundler from using gems from a parent workspace's vendor/bundle, which could have different versions. This fixes the Shakapacker version mismatch error in CI where the generated app had shakapacker 8.2.0 installed but Rails was loading shakapacker 9.4.0 from the parent react_on_rails vendor/bundle. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]>
1 parent 40e9642 commit ef3377f

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

react_on_rails/rakelib/shakapacker_examples.rake

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -113,8 +113,11 @@ namespace :shakapacker_examples do # rubocop:disable Metrics/BlockLength
113113

114114
sh_in_dir(example_type.dir, "npm install")
115115
# Generate the component packs after running the generator to ensure all
116-
# auto-bundled components have corresponding pack files created
117-
sh_in_dir(example_type.dir, "bundle exec rake react_on_rails:generate_packs")
116+
# auto-bundled components have corresponding pack files created.
117+
# Use BUNDLE_GEMFILE to ensure bundler uses the generated app's Gemfile
118+
# and not any parent workspace's bundle, which could have different gem versions.
119+
gemfile_path = File.join(example_type.dir, "Gemfile")
120+
sh_in_dir(example_type.dir, "BUNDLE_GEMFILE=#{gemfile_path} bundle exec rake react_on_rails:generate_packs")
118121
end
119122
end
120123

0 commit comments

Comments
 (0)