Commit 979dd50
Fix NODE_ENV not being set when running shakapacker-dev-server (#823)
The DevServerRunner class was missing calls to
Shakapacker.ensure_node_env! in both the main run() method and
run_with_build_config() method. This caused NODE_ENV to be undefined
when users ran bin/shakapacker-dev-server, breaking webpack configs that
dynamically require environment-specific files.
This fix ensures NODE_ENV is properly set to match RAILS_ENV (or
"production" by default) before executing the dev server, consistent
with how WebpackRunner and the base Runner class handle environment
initialization.
Fixes #802
🤖 Generated with [Claude Code](https://claude.com/claude-code)
### Summary
<!--
Describe the code changes in your pull request here - were there any
bugs you had fixed, features you added, tradeoffs you made?
If so, mention them. If these changes have open GitHub issues, tag them
here as well to keep the conversation linked.
-->
### Pull Request checklist
<!-- If any of the items on this checklist do not apply to the PR, both
check it out and wrap it by `~`. -->
- [ ] Add/update test to cover these changes
- [ ] Update documentation
- [ ] Update CHANGELOG file
<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit
* **Bug Fixes**
* Development server now ensures the Node environment is properly
initialized before starting, preventing potential environment-related
configuration issues.
* **Tests**
* Added verification that NODE_ENV is correctly set to "development"
when required.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
Co-authored-by: Claude <[email protected]>1 parent 272cb11 commit 979dd50
File tree
2 files changed
+35
-0
lines changed- lib/shakapacker
- spec/shakapacker
2 files changed
+35
-0
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
18 | 18 | | |
19 | 19 | | |
20 | 20 | | |
| 21 | + | |
| 22 | + | |
21 | 23 | | |
22 | 24 | | |
23 | 25 | | |
| |||
65 | 67 | | |
66 | 68 | | |
67 | 69 | | |
| 70 | + | |
| 71 | + | |
68 | 72 | | |
69 | 73 | | |
70 | 74 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
136 | 136 | | |
137 | 137 | | |
138 | 138 | | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
139 | 170 | | |
140 | 171 | | |
141 | 172 | | |
| |||
0 commit comments