Skip to content
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

Support other means of Webpack sockets #10

Closed
sibelius opened this issue Dec 7, 2019 · 4 comments · Fixed by #64
Closed

Support other means of Webpack sockets #10

sibelius opened this issue Dec 7, 2019 · 4 comments · Fixed by #64

Comments

@sibelius
Copy link

sibelius commented Dec 7, 2019

Uncaught TypeError: connection.onClose is not a function
    at createSocket (webpack-internal:///../../node_modules/@pmmmwh/react-refresh-webpack-plugin/src/runtime/createSocket.js:32)
    at eval (webpack-internal:///../../node_modules/@pmmmwh/react-refresh-webpack-plugin/src/runtime/ErrorOverlayEntry.js:80)
    at Object.../../node_modules/@pmmmwh/react-refresh-webpack-plugin/src/runtime/ErrorOverlayEntry.js (bundle.js:4276)
    at __webpack_require__ (bundle.js:736)

this is the problem

let SocketClient;
if (typeof __webpack_dev_server_client__ !== 'undefined') {
  SocketClient = __webpack_dev_server_client__;
} else {
  SocketClient = __webpack_require__("../../node_modules/sockjs-client/lib/entry.js");
}

we are using https://github.com/shellscape/webpack-plugin-serve instead of https://github.com/webpack/webpack-dev-server

maybe @shellscape or @playma256 can help us with this one

@shellscape
Copy link

@sibelius this module looks to be specifically tailored to webpack-dev-server. WPS doesn't use sockjs and we don't export WDS variables, so this module will probably have to allow for detection of WPS and use the socket provided.

@pmmmwh
Copy link
Owner

pmmmwh commented Dec 7, 2019

Uncaught TypeError: connection.onClose is not a function
    at createSocket (webpack-internal:///../../node_modules/@pmmmwh/react-refresh-webpack-plugin/src/runtime/createSocket.js:32)
    at eval (webpack-internal:///../../node_modules/@pmmmwh/react-refresh-webpack-plugin/src/runtime/ErrorOverlayEntry.js:80)
    at Object.../../node_modules/@pmmmwh/react-refresh-webpack-plugin/src/runtime/ErrorOverlayEntry.js (bundle.js:4276)
    at __webpack_require__ (bundle.js:736)

this is the problem

let SocketClient;
if (typeof __webpack_dev_server_client__ !== 'undefined') {
  SocketClient = __webpack_dev_server_client__;
} else {
  SocketClient = __webpack_require__("../../node_modules/sockjs-client/lib/entry.js");
}

we are using shellscape/webpack-plugin-serve instead of webpack/webpack-dev-server

maybe @shellscape or @playma256 can help us with this one

Yes - this is unfortunately a limitation right now. For the current implementation, I purposefully stick to what CRA is doing so as to allow easier integration with them. I will need to look at the socket implementation for WPS and come up with a way to allow users to customize this function. Thanks for raising this though - I was planning to support custom sockets anyways.

@tim-soft
Copy link

tim-soft commented Dec 7, 2019

I'm also seeing this with wepback-dev-middleware + webpack-hot-middleware + express

@pmmmwh pmmmwh changed the title Uncaught TypeError: connection.onClose is not a function Support other means of Webpack sockets Dec 12, 2019
@pmmmwh
Copy link
Owner

pmmmwh commented Feb 27, 2020

Support for Webpack Hot Middleware landed #23 !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants