Commit 3b9ad52
Fix bin/dev pack generation failure when run from Bundler context
When bin/dev loads bundler/setup and then PackGenerator tries to run
"bundle exec rake", it fails due to Bundler path conflicts. The system
command tries to spawn a new bundle process from within an already-setup
Bundler environment, causing Ruby/Bundler version mismatches.
Solution: Detect if we're already in a Bundler context and directly
invoke the Rake task instead of shelling out to "bundle exec rake".
This avoids the nested Bundler issue while maintaining compatibility
with non-Bundler environments.
Changes:
- lib/react_on_rails/dev/pack_generator.rb:
- Add run_pack_generation method to detect Bundler context
- Add run_rake_task_directly to invoke Rake task in-process
- Add run_via_bundle_exec for non-Bundler environments
- Load Rails environment when needed for in-process execution
Fixes: bin/dev static (and other bin/dev commands) now successfully
generate packs before starting the development server.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <[email protected]>1 parent d1cff23 commit 3b9ad52
1 file changed
+52
-2
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
9 | 9 | | |
10 | 10 | | |
11 | 11 | | |
12 | | - | |
| 12 | + | |
13 | 13 | | |
14 | 14 | | |
15 | | - | |
| 15 | + | |
16 | 16 | | |
17 | 17 | | |
18 | 18 | | |
| |||
21 | 21 | | |
22 | 22 | | |
23 | 23 | | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
24 | 74 | | |
25 | 75 | | |
26 | 76 | | |
| |||
0 commit comments