Commit 14c81f1
Update webpack config templates for unified rspack/webpack support
Implements unified configuration approach where the same webpack config
files work with both webpack and rspack bundlers, based on the
assets_bundler setting in shakapacker.yml.
## Changes
**development.js.tt**:
- Add config import from shakapacker to access assets_bundler setting
- Conditional React Refresh plugin loading:
- Rspack: @rspack/plugin-react-refresh
- Webpack: @pmmmwh/react-refresh-webpack-plugin
- Prevents "window not found" errors when using rspack
**serverWebpackConfig.js.tt**:
- Replace hardcoded webpack require with bundler variable
- Bundler conditionally requires @rspack/core or webpack
- Use bundler.optimize.LimitChunkCountPlugin instead of webpack-specific
- Eliminates warnings about webpack when using rspack
**RSPACK_IMPLEMENTATION.md**:
- Document webpack config template changes
- Explain unified configuration approach
## Benefits
- Single set of config files works for both bundlers
- No warnings when using rspack about webpack.config.js
- Seamless switching between bundlers via bin/switch-bundler
- Follows pattern from react_on_rails-demos PR #20
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <[email protected]>1 parent 2af94e7 commit 14c81f1
File tree
3 files changed
+39
-12
lines changed- lib/generators/react_on_rails/templates/base/base/config/webpack
3 files changed
+39
-12
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
28 | 28 | | |
29 | 29 | | |
30 | 30 | | |
31 | | - | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
32 | 51 | | |
33 | 52 | | |
34 | 53 | | |
| |||
Lines changed: 15 additions & 9 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | | - | |
| 3 | + | |
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
7 | 7 | | |
8 | | - | |
9 | | - | |
| 8 | + | |
10 | 9 | | |
11 | 10 | | |
12 | | - | |
13 | | - | |
14 | | - | |
15 | | - | |
16 | | - | |
17 | | - | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
18 | 24 | | |
19 | 25 | | |
20 | 26 | | |
| |||
Lines changed: 4 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
6 | | - | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
7 | 9 | | |
8 | 10 | | |
9 | 11 | | |
| |||
40 | 42 | | |
41 | 43 | | |
42 | 44 | | |
43 | | - | |
| 45 | + | |
44 | 46 | | |
45 | 47 | | |
46 | 48 | | |
| |||
0 commit comments