From cab5da5b80e911b25fcedacce0056e887d502b0b Mon Sep 17 00:00:00 2001 From: Andrew Powell Date: Tue, 8 Aug 2017 14:08:45 -0400 Subject: [PATCH] 2.7.0 rollback (#1023) * Revert "Sockjs prefix config (#911)" This reverts commit ccd113a36e4217ef30e8f9679b4ab58773795b38. * Revert "2.7.0 (#1020)" This reverts commit c8b9a0fc36e7ef338dc3da4926f25d381c3367bc. --- client/index.js | 10 +------- examples/node-api-sockjs-prefix/README.md | 15 ----------- examples/node-api-sockjs-prefix/app.js | 7 ------ examples/node-api-sockjs-prefix/index.html | 9 ------- examples/node-api-sockjs-prefix/server.js | 25 ------------------- .../node-api-sockjs-prefix/webpack.config.js | 8 ------ lib/Server.js | 3 +-- lib/optionsSchema.json | 4 --- package.json | 2 +- test/Validation.test.js | 2 +- 10 files changed, 4 insertions(+), 81 deletions(-) delete mode 100644 examples/node-api-sockjs-prefix/README.md delete mode 100644 examples/node-api-sockjs-prefix/app.js delete mode 100644 examples/node-api-sockjs-prefix/index.html delete mode 100644 examples/node-api-sockjs-prefix/server.js delete mode 100644 examples/node-api-sockjs-prefix/webpack.config.js diff --git a/client/index.js b/client/index.js index 30b8fe4869..4903179b6a 100644 --- a/client/index.js +++ b/client/index.js @@ -170,20 +170,12 @@ if(hostname && (self.location.protocol === "https:" || urlParts.hostname === "0. protocol = self.location.protocol; } -var rootPathName = url.parse(__webpack_public_path__).pathname || ""; // eslint-disable-line no-undef - -if(rootPathName.length > 1) { - rootPathName = rootPathName.replace(/\/+$/, ""); -} - -var sockjsPath = rootPathName + "/sockjs-node"; - var socketUrl = url.format({ protocol: protocol, auth: urlParts.auth, hostname: hostname, port: (urlParts.port === "0") ? self.location.port : urlParts.port, - pathname: urlParts.path == null || urlParts.path === "/" ? sockjsPath : urlParts.path + pathname: urlParts.path == null || urlParts.path === "/" ? "/sockjs-node" : urlParts.path }); socket(socketUrl, onSocketMsg); diff --git a/examples/node-api-sockjs-prefix/README.md b/examples/node-api-sockjs-prefix/README.md deleted file mode 100644 index 1ce352b141..0000000000 --- a/examples/node-api-sockjs-prefix/README.md +++ /dev/null @@ -1,15 +0,0 @@ -# Node.js API - Simple - -```shell -node server.js -``` - -Starts a simple webpack-dev-server setup via the Node API. Open `http://localhost:8080/` to go the app. - -## What should happen - -In the app you should see "It's working." - -In `app.js`, uncomment the code that results in an error and save. This error should be visible in the CLI and devtools. - -Then, in `app.js`, uncomment the code that results in a warning. This warning should be visible in the CLI and devtools. diff --git a/examples/node-api-sockjs-prefix/app.js b/examples/node-api-sockjs-prefix/app.js deleted file mode 100644 index 731be32436..0000000000 --- a/examples/node-api-sockjs-prefix/app.js +++ /dev/null @@ -1,7 +0,0 @@ -document.write("It's working under a subapp"); - -// This results in a warning: -if(!window) require("./" + window + "parseable.js"); - -// This results in an error: -// if(!window) require("test"); diff --git a/examples/node-api-sockjs-prefix/index.html b/examples/node-api-sockjs-prefix/index.html deleted file mode 100644 index 86fc28b105..0000000000 --- a/examples/node-api-sockjs-prefix/index.html +++ /dev/null @@ -1,9 +0,0 @@ - - - - - - -

Example: Node.js API - Simple

- - diff --git a/examples/node-api-sockjs-prefix/server.js b/examples/node-api-sockjs-prefix/server.js deleted file mode 100644 index e2307d5360..0000000000 --- a/examples/node-api-sockjs-prefix/server.js +++ /dev/null @@ -1,25 +0,0 @@ -"use strict"; - -const Webpack = require("webpack"); -const path = require("path"); -const WebpackDevServer = require("../../lib/Server"); -const webpackConfig = require("./webpack.config"); - -const compiler = Webpack(webpackConfig); -const server = new WebpackDevServer(compiler, { - stats: { - colors: true - }, - contentBase: path.resolve(__dirname), - watchContentBase: true, - sockjsPrefix: "/subapp", - publicPath: "/subapp/", - historyApiFallback: { - disableDotRule: true, - index: "/subapp/" - }, -}); - -server.listen(8080, "127.0.0.1", function() { - console.log("Starting server on http://localhost:8080"); -}); diff --git a/examples/node-api-sockjs-prefix/webpack.config.js b/examples/node-api-sockjs-prefix/webpack.config.js deleted file mode 100644 index 4afd582e86..0000000000 --- a/examples/node-api-sockjs-prefix/webpack.config.js +++ /dev/null @@ -1,8 +0,0 @@ -module.exports = { - context: __dirname, - entry: ["./app.js", "../../client/index.js?http://localhost:8080/"], - output: { - filename: "bundle.js", - publicPath: "/subapp/" - }, -} diff --git a/lib/Server.js b/lib/Server.js index 07ff2878ab..0805d8b910 100644 --- a/lib/Server.js +++ b/lib/Server.js @@ -42,7 +42,6 @@ function Server(compiler, options) { this.disableHostCheck = !!options.disableHostCheck; this.publicHost = options.public; this.allowedHosts = options.allowedHosts; - this.sockjsPrefix = options.sockjsPrefix || "" this.sockets = []; this.contentBaseWatchers = []; @@ -521,7 +520,7 @@ Server.prototype.listen = function(port, hostname) { }); sockServer.installHandlers(this.listeningApp, { - prefix: `${this.sockjsPrefix}/sockjs-node` + prefix: "/sockjs-node" }); return returnValue; } diff --git a/lib/optionsSchema.json b/lib/optionsSchema.json index be7079c089..885c64191c 100644 --- a/lib/optionsSchema.json +++ b/lib/optionsSchema.json @@ -54,10 +54,6 @@ } ] }, - "sockjsPrefix": { - "description": "Optional prefix for the sockjs handler to be mounted to.", - "type": "string" - }, "socket": { "description": "The Unix socket to listen to (instead of on a host).", "type": "string" diff --git a/package.json b/package.json index c3187ad98a..9cb4e3ee26 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "webpack-dev-server", - "version": "2.7.0", + "version": "2.6.1", "author": "Tobias Koppers @sokra", "description": "Serves a webpack app. Updates the browser on changes.", "peerDependencies": { diff --git a/test/Validation.test.js b/test/Validation.test.js index 61024ded12..8da8b29815 100644 --- a/test/Validation.test.js +++ b/test/Validation.test.js @@ -48,7 +48,7 @@ describe("Validation", function() { config: { asdf: true }, message: [ " - configuration has an unknown property 'asdf'. These properties are valid:", - " object { hot?, hotOnly?, lazy?, bonjour?, host?, allowedHosts?, filename?, publicPath?, port?, sockjsPrefix?, socket?, " + + " object { hot?, hotOnly?, lazy?, bonjour?, host?, allowedHosts?, filename?, publicPath?, port?, socket?, " + "watchOptions?, headers?, clientLogLevel?, overlay?, key?, cert?, ca?, pfx?, pfxPassphrase?, " + "inline?, disableHostCheck?, public?, https?, contentBase?, watchContentBase?, open?, useLocalIp?, openPage?, features?, " + "compress?, proxy?, historyApiFallback?, staticOptions?, setup?, stats?, reporter?, " +