Skip to content

Remove unsupported overlay property for ReactRefreshWebpackPlugin #1748

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jul 16, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ To enable the HMR functionality, you have to use `./bin/shakapacker-dev-server`
}
```

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)`.
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.

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

Expand Down
9 changes: 1 addition & 8 deletions docs/guides/rails-webpacker-react-integration-options.md
Original file line number Diff line number Diff line change
Expand Up @@ -132,14 +132,7 @@ You can see an example commit of adding this [here](https://github.com/shakacode

//plugins
if (isWebpackDevServer) {
environment.plugins.append(
'ReactRefreshWebpackPlugin',
new ReactRefreshWebpackPlugin({
overlay: {
sockPort: 3035,
},
}),
);
environment.plugins.append('ReactRefreshWebpackPlugin', new ReactRefreshWebpackPlugin({}));
}
```

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,7 @@ const developmentEnvOnly = (clientWebpackConfig, _serverWebpackConfig) => {
// eslint-disable-next-line global-require
const ReactRefreshWebpackPlugin = require('@pmmmwh/react-refresh-webpack-plugin');
clientWebpackConfig.plugins.push(
new ReactRefreshWebpackPlugin({
overlay: {
sockPort: devServer.port,
},
}),
new ReactRefreshWebpackPlugin({}),
);
}
};
Expand Down
10 changes: 2 additions & 8 deletions spec/dummy/config/webpack/development.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
process.env.NODE_ENV = process.env.NODE_ENV || 'development';

const { devServer, inliningCss } = require('shakapacker');
const { inliningCss } = require('shakapacker');

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

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

// eslint-disable-next-line global-require
const ReactRefreshWebpackPlugin = require('@pmmmwh/react-refresh-webpack-plugin');
clientWebpackConfig.plugins.push(
new ReactRefreshWebpackPlugin({
overlay: {
sockPort: devServer.port,
},
}),
);
clientWebpackConfig.plugins.push(new ReactRefreshWebpackPlugin({}));
}
};

Expand Down
4 changes: 3 additions & 1 deletion spec/dummy/tests/react-on-rails.import.test.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import ReactOnRails from 'react-on-rails';

test('ReactOnRails', () => {
ReactOnRails.register({});
expect(() => {
ReactOnRails.register({});
}).not.toThrow();
});
4 changes: 3 additions & 1 deletion spec/dummy/tests/react-on-rails.require.test.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
const ReactOnRails = require('react-on-rails').default;

test('ReactOnRails', () => {
ReactOnRails.register({});
expect(() => {
ReactOnRails.register({});
}).not.toThrow();
});
Loading