Commit a8fb0da
Fix ExecJS compatibility: remove libraryTarget commonjs2 for default setup
Root cause: Setting libraryTarget: 'commonjs2' creates bundles that require
Node.js's require() function, which is not available in ExecJS (the default
server rendering engine).
Changes:
- Removed libraryTarget: 'commonjs2' from spec/dummy (uses ExecJS)
- Removed libraryTarget: 'commonjs2' from execjs-compatible-dummy
- Updated generator template with clear comments about when to use it
- Kept target: 'node' to externalize Node.js built-in modules (required for React 19)
The fix:
- target: 'node' externalizes crypto, async_hooks, stream (✅ needed for React 19)
- libraryTarget: 'commonjs2' only for Node renderer (❌ breaks ExecJS)
Fixes CI errors:
- TypeError: require is not a function (ExecJS evaluation error)
- examples (3.4, latest)
- examples (3.2, minimum)
- dummy-app-integration-tests
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <[email protected]>1 parent 57a49ad commit a8fb0da
File tree
3 files changed
+11
-6
lines changed- lib/generators/react_on_rails/templates/base/base/config/webpack
- react_on_rails_pro/spec/execjs-compatible-dummy/config/webpack
- spec/dummy/config/webpack
3 files changed
+11
-6
lines changedLines changed: 4 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
50 | 50 | | |
51 | 51 | | |
52 | 52 | | |
53 | | - | |
54 | | - | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
55 | 57 | | |
56 | 58 | | |
57 | 59 | | |
| |||
Lines changed: 3 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
48 | 48 | | |
49 | 49 | | |
50 | 50 | | |
| 51 | + | |
| 52 | + | |
51 | 53 | | |
52 | | - | |
53 | | - | |
| 54 | + | |
54 | 55 | | |
55 | 56 | | |
56 | 57 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
45 | 45 | | |
46 | 46 | | |
47 | 47 | | |
48 | | - | |
49 | | - | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
50 | 52 | | |
51 | 53 | | |
52 | 54 | | |
| |||
0 commit comments