To create a custom server implementation.
This mode uses ws as a server.
webpack.config.js
module.exports = {
// ...
devServer: {
webSocketServer: "ws",
},
};
Usage via CLI:
npx webpack serve --web-socket-server-type ws --open
- The script should open
http://localhost:8080/
in your default browser. - You should see the text on the page itself change to read
Success!
.