Uncaught TypeError: SocketClient is not a constructor
See original GitHub issueI have tried for a long time to get the React Refresh Webpack plugin working! I am using my own custom configuration for webpack, not create-react-app
. When I was using the overlay of create-react-app
it was working as expected:
process.env.NODE_ENV = "development";
process.env.BABEL_ENV = process.env.NODE_ENV;
const webpack = require("webpack");
const common = require("./webpack.common");
const { merge } = require("webpack-merge");
const ReactRefreshWebpackPlugin = require("@pmmmwh/react-refresh-webpack-plugin");
const webpackDevClientEntry = require.resolve(
"react-dev-utils/webpackHotDevClient"
);
const reactRefreshOverlayEntry = require.resolve(
"react-dev-utils/refreshOverlayInterop"
);
module.exports = merge(common, {
mode: "development",
devtool: "source-map",
plugins: [
new webpack.HotModuleReplacementPlugin(),
new ReactRefreshWebpackPlugin({
overlay: {
entry: webpackDevClientEntry,
module: reactRefreshOverlayEntry
}
})
]
});
But after using new ReactRefreshWebpackPlugin()
without options, I got this error in the browser console, my terminal (webpack compilation) has no error…
`
Issue Analytics
- State:
- Created 2 years ago
- Comments:9 (3 by maintainers)
Top Results From Across the Web
'SocketClient is not a constructor' in react-refresh-webpack ...
I would use export default { instead of module.exports = {; You need to use the latest refresh plugin (0.5.0), explanation is in...
Read more >Webpack使用ReactHMR时出现SocketClient is not a ...
Uncaught TypeError : SocketClient is not a constructor at initWDSSocket (build.js:2229:24). 1; 2. 在这里插入图片描述
Read more >SocketClient is not a constructor 오류 - 인프런 | 질문 & 답변
RefreshWebpackPlugin = require("@pmmmwh/react-refresh-webpack-plugin"); ; devtool: "eval", resolve ; module: { rules: [ { test ...
Read more >Laravel-mix error compile webpack.LoaderOptionsPlugin ...
c:\development\php\laravel\webpack.config.js:252 new webpack.LoaderOptionsPlugin({ ^ TypeError: webpack.LoaderOptionsPlugin is not a constructor at Object.
Read more >Migrating from 2.x to 3.0
A v3 client is still not be able to connect to a v2 server though. ... Uncaught TypeError: packet.data is undefined.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Support for this particular config would be added, maybe later this week, but is not there yet now. However you can override the options by using the
overlay
option of this plugin.I think I’ve found what causes this issue:
it should be: