Skip to content

Commit 805b242

Browse files
justin808claude
andcommitted
fix(pro-dummy): guard sockPort parseInt with || 3035 fallback
`parseInt(undefined, 10)` returns NaN, which would be silently passed to ReactRefreshWebpackPlugin if devServer.port was ever absent. Falling back to Shakapacker's default port (3035) surfaces a misconfiguration as a wrong port rather than silent NaN. Applied to both the Pro dummy and the execjs-compatible dummy webpack configs for consistency. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent 30fcbe8 commit 805b242

2 files changed

Lines changed: 6 additions & 2 deletions

File tree

react_on_rails_pro/spec/dummy/config/webpack/development.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,9 @@ const developmentEnvOnly = (clientWebpackConfig, _serverWebpackConfig) => {
1313
overlay: {
1414
// bin/dev sets SHAKAPACKER_DEV_SERVER_PORT as a string, which Shakapacker
1515
// surfaces unchanged on devServer.port. The plugin schema requires a number.
16-
sockPort: parseInt(devServer.port, 10),
16+
// `|| 3035` falls back to Shakapacker's default if devServer.port is missing,
17+
// so a misconfiguration surfaces as a wrong port rather than silent NaN.
18+
sockPort: parseInt(devServer.port, 10) || 3035,
1719
},
1820
}),
1921
);

react_on_rails_pro/spec/execjs-compatible-dummy/config/webpack/development.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,9 @@ const developmentEnvOnly = (clientWebpackConfig, _serverWebpackConfig) => {
1818
overlay: {
1919
// bin/dev sets SHAKAPACKER_DEV_SERVER_PORT as a string, which Shakapacker
2020
// surfaces unchanged on devServer.port. The plugin schema requires a number.
21-
sockPort: parseInt(devServer.port, 10),
21+
// `|| 3035` falls back to Shakapacker's default if devServer.port is missing,
22+
// so a misconfiguration surfaces as a wrong port rather than silent NaN.
23+
sockPort: parseInt(devServer.port, 10) || 3035,
2224
},
2325
}),
2426
);

0 commit comments

Comments
 (0)