Commit b29ba69
Fix using_swc? to properly parse YAML and default to babel
Change using_swc? helper to parse shakapacker.yml with YAML.safe_load_file
instead of raw string matching, which incorrectly interpreted commented
lines as active configuration.
Changes:
- Add require "yaml" to base_generator.rb
- Parse YAML to read javascript_compiler from default section
- Return true only when javascript_compiler is explicitly set to "swc"
- Default to false (babel) when file is missing or key is absent
- Add error handling for YAML parsing failures
- Update template comment to reflect babel as default
This ensures commented configuration lines don't affect compiler detection
and provides more predictable behavior.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <[email protected]>1 parent 34f3410 commit b29ba69
File tree
2 files changed
+18
-9
lines changed- lib/generators/react_on_rails
- templates/base/base/config
2 files changed
+18
-9
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
| 5 | + | |
5 | 6 | | |
6 | 7 | | |
7 | 8 | | |
| |||
232 | 233 | | |
233 | 234 | | |
234 | 235 | | |
235 | | - | |
| 236 | + | |
236 | 237 | | |
237 | | - | |
238 | | - | |
239 | | - | |
240 | | - | |
241 | | - | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
| 249 | + | |
| 250 | + | |
242 | 251 | | |
243 | 252 | | |
244 | 253 | | |
| |||
Lines changed: 3 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
58 | 58 | | |
59 | 59 | | |
60 | 60 | | |
61 | | - | |
62 | | - | |
63 | | - | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
64 | 64 | | |
65 | 65 | | |
66 | 66 | | |
| |||
0 commit comments