Commit dca30af
## Summary
Fixes #1850 by correcting the `shakapacker.yml` template configuration
to prevent unnecessary "Slow setup for development" warnings when using
Procfiles with `bin/dev`.
## Changes
- **Set `compile: false` in default section** - This becomes the default
for development and production environments
- **Remove `compile: true` from development section** - Now inherits
`compile: false` from default
- **Keep `compile: true` in test section** - Tests still need on-demand
compilation
- **Add clarifying comments** - Explain when to use `compile: true` vs
`false`
## Problem Solved
Previously, the installer generated:
```yaml
development:
compile: true # ❌ Wrong - causes on-demand compilation
```
This caused Rails to attempt on-demand asset compilation even when
`bin/shakapacker-dev-server` or `bin/shakapacker --watch` were already
running via Procfiles, resulting in this warning on every request:
```
Shakapacker::Compiler - Slow setup for development
Prepare JS assets with either:
1. Running bin/shakapacker-dev-server
2. Set compile to false in shakapacker.yml and run bin/shakapacker -w
```
## After This Fix
The generated configuration now follows best practices:
```yaml
default: &default
compile: false # Default is false (use Procfiles)
development:
<<: *default
# Inherits compile: false - no on-demand compilation
test:
<<: *default
compile: true # Only tests need on-demand compilation
production:
<<: *default
compile: false # Assets are precompiled
```
## Impact
- ✅ Eliminates confusing warnings on every page load during development
- ✅ Aligns with standard Procfile-based development workflow
- ✅ Maintains correct behavior for test environment
- ✅ No impact on production (already had `compile: false`)
## Test Plan
- [x] Changes made to installer template
- [x] RuboCop passes with no violations
- [x] Pre-commit hooks pass (prettier, trailing newlines)
To test the fix:
1. Generate a new app with the updated installer
2. Run `bin/dev` (which starts rails server + shakapacker-dev-server)
3. Visit any page
4. Verify no "Slow setup for development" warning appears in logs
🤖 Generated with [Claude Code](https://claude.com/claude-code)
<!-- Reviewable:start -->
- - -
This change is [<img src="https://reviewable.io/review_button.svg"
height="34" align="absmiddle"
alt="Reviewable"/>](https://reviewable.io/reviews/shakacode/react_on_rails/2021)
<!-- Reviewable:end -->
<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit
* **Chores**
* Updated default build configuration to use on-demand compilation
instead of always compiling. Development environments now inherit this
default behavior for optimized build performance.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
Co-authored-by: Claude <[email protected]>
1 parent 4ffba19 commit dca30af
File tree
1 file changed
+5
-1
lines changed- lib/generators/react_on_rails/templates/base/base/config
1 file changed
+5
-1
lines changedLines changed: 5 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
55 | 55 | | |
56 | 56 | | |
57 | 57 | | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
58 | 63 | | |
59 | 64 | | |
60 | 65 | | |
| |||
72 | 77 | | |
73 | 78 | | |
74 | 79 | | |
75 | | - | |
76 | 80 | | |
77 | 81 | | |
78 | 82 | | |
| |||
0 commit comments