MCPcopy
hub / github.com/webpack/webpack-dev-server / setup

Function setup

test/server/proxy-option.test.js:854–885  ·  view source on GitHub ↗
(devServerOptions)

Source from the content-addressed store, hash-verified

852 // Start a backend WebSocket server (the user proxy target) and a dev-server
853 // proxying everything to it, with the given dev-server options merged in.
854 const setup = async (devServerOptions) => {
855 backendUpgradeCount = 0;
856
857 backend = http.createServer();
858 backendWss = new WebSocketServer({ server: backend });
859 backendWss.on("connection", () => {
860 backendUpgradeCount += 1;
861 });
862
863 await new Promise((resolve) => {
864 backend.listen(port5, resolve);
865 });
866
867 server = new Server(
868 {
869 hot: true,
870 allowedHosts: "all",
871 proxy: [
872 {
873 context: "/",
874 target: `http://localhost:${port5}`,
875 ws: true,
876 },
877 ],
878 port: port3,
879 ...devServerOptions,
880 },
881 webpack(config),
882 );
883
884 await server.start();
885 };
886
887 const teardown = async () => {
888 for (const client of backendWss.clients) {

Callers 1

Calls 3

createServerMethod · 0.80
listenMethod · 0.80
startMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…