Skip to content

Commit f8b28b8

Browse files
Judahmeekjusleg
andauthored
Remove unsupported overlay property for ReactRefreshWebpackPlugin (#1748)
* Remove unsupported overlay property for ReactRefreshWebpackPlugin The v0.6.0 release introduced breaking changes which removed `sockPort` as a property https://github.com/pmmmwh/react-refresh-webpack-plugin/releases/tag/v0.6.0. (pr: pmmmwh/react-refresh-webpack-plugin#850). This updates the generator template for development.js to no longer pass the property. This was tested by successfully creating a new rails 8.0.2 project with ReactRefreshWebpackPlugin 0.6.1 and following the tutorial (https://www.shakacode.com/react-on-rails/docs/guides/tutorial/) * linting --------- Co-authored-by: Justin Léger <[email protected]>
1 parent 90a5666 commit f8b28b8

File tree

4 files changed

+5
-22
lines changed

4 files changed

+5
-22
lines changed

docs/guides/hmr-and-hot-reloading-with-the-webpack-dev-server.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ To enable the HMR functionality, you have to use `./bin/shakapacker-dev-server`
8585
}
8686
```
8787

88-
We added `overlay.sockPort` option in `ReactRefreshWebpackPlugin` to match the webpack-dev-server port specified in `config/shakapacker.yml`. This makes SockJS works properly and fixes this error in browser console: `GET http://localhost:[port]/sockjs-node/info?t=[xxxxxxxxxx] 404 (Not Found)`.
88+
We added `overlay.sockPort` option in `ReactRefreshWebpackPlugin` to match the webpack-dev-server port specified in `config/shakapacker.yml`. This makes SockJS works properly and fixes this error in browser console: `GET http://localhost:[port]/sockjs-node/info?t=[xxxxxxxxxx] 404 (Not Found)`. When using `ReactRefreshWebpackPlugin` with `v0.6.0` and newer, `overlay.sockPort` is [no longer supported](https://github.com/pmmmwh/react-refresh-webpack-plugin/pull/850) and should be omitted from the configurations.
8989

9090
4. Add the react-refresh plugin in `babel.config.js`
9191

docs/guides/rails-webpacker-react-integration-options.md

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -132,14 +132,7 @@ You can see an example commit of adding this [here](https://github.com/shakacode
132132
133133
//plugins
134134
if (isWebpackDevServer) {
135-
environment.plugins.append(
136-
'ReactRefreshWebpackPlugin',
137-
new ReactRefreshWebpackPlugin({
138-
overlay: {
139-
sockPort: 3035,
140-
},
141-
}),
142-
);
135+
environment.plugins.append('ReactRefreshWebpackPlugin', new ReactRefreshWebpackPlugin({}));
143136
}
144137
```
145138

lib/generators/react_on_rails/templates/base/base/config/webpack/development.js.tt

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,7 @@ const developmentEnvOnly = (clientWebpackConfig, _serverWebpackConfig) => {
1313
// eslint-disable-next-line global-require
1414
const ReactRefreshWebpackPlugin = require('@pmmmwh/react-refresh-webpack-plugin');
1515
clientWebpackConfig.plugins.push(
16-
new ReactRefreshWebpackPlugin({
17-
overlay: {
18-
sockPort: devServer.port,
19-
},
20-
}),
16+
new ReactRefreshWebpackPlugin({}),
2117
);
2218
}
2319
};

spec/dummy/config/webpack/development.js

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
process.env.NODE_ENV = process.env.NODE_ENV || 'development';
22

3-
const { devServer, inliningCss } = require('shakapacker');
3+
const { inliningCss } = require('shakapacker');
44

55
const webpackConfig = require('./webpackConfig');
66

@@ -12,13 +12,7 @@ const developmentEnvOnly = (clientWebpackConfig, _serverWebpackConfig) => {
1212

1313
// eslint-disable-next-line global-require
1414
const ReactRefreshWebpackPlugin = require('@pmmmwh/react-refresh-webpack-plugin');
15-
clientWebpackConfig.plugins.push(
16-
new ReactRefreshWebpackPlugin({
17-
overlay: {
18-
sockPort: devServer.port,
19-
},
20-
}),
21-
);
15+
clientWebpackConfig.plugins.push(new ReactRefreshWebpackPlugin({}));
2216
}
2317
};
2418

0 commit comments

Comments
 (0)