webpack-dev-server 4.0.0-beta.2 → 4.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +109 -58
- package/bin/cli-flags.js +827 -269
- package/bin/process-arguments.js +332 -0
- package/bin/webpack-dev-server.js +46 -30
- package/client/clients/SockJSClient.js +11 -44
- package/client/clients/WebSocketClient.js +43 -0
- package/client/index.js +90 -98
- package/client/modules/logger/index.js +90 -2736
- package/client/modules/sockjs-client/index.js +127 -41
- package/client/modules/strip-ansi/index.js +69 -37
- package/client/overlay.js +111 -95
- package/client/socket.js +11 -12
- package/client/utils/createSocketURL.js +70 -0
- package/client/utils/getCurrentScriptSource.js +10 -9
- package/client/utils/log.js +5 -10
- package/client/utils/parseURL.js +43 -0
- package/client/utils/reloadApp.js +49 -36
- package/client/utils/sendMessage.js +3 -5
- package/lib/Server.js +1456 -539
- package/lib/options.json +562 -314
- package/lib/servers/BaseServer.js +2 -1
- package/lib/servers/SockJSServer.js +32 -31
- package/lib/servers/WebsocketServer.js +42 -41
- package/lib/utils/DevServerPlugin.js +275 -128
- package/package.json +51 -52
- package/CHANGELOG.md +0 -569
- package/client/clients/BaseClient.js +0 -23
- package/client/clients/WebsocketClient.js +0 -76
- package/client/modules/logger/SyncBailHookFake.js +0 -10
- package/client/utils/createSocketUrl.js +0 -94
- package/client/webpack.config.js +0 -57
- package/lib/utils/colors.js +0 -22
- package/lib/utils/createCertificate.js +0 -69
- package/lib/utils/createDomain.js +0 -31
- package/lib/utils/defaultPort.js +0 -3
- package/lib/utils/defaultTo.js +0 -7
- package/lib/utils/findPort.js +0 -39
- package/lib/utils/getCertificate.js +0 -50
- package/lib/utils/getColorsOption.js +0 -15
- package/lib/utils/getCompilerConfigArray.js +0 -8
- package/lib/utils/getSocketClientPath.d.ts +0 -3
- package/lib/utils/getSocketClientPath.js +0 -38
- package/lib/utils/getSocketServerImplementation.js +0 -42
- package/lib/utils/getStatsOption.js +0 -16
- package/lib/utils/getVersions.js +0 -10
- package/lib/utils/normalizeOptions.js +0 -122
- package/lib/utils/routes.js +0 -70
- package/lib/utils/runBonjour.js +0 -21
- package/lib/utils/runOpen.js +0 -83
- package/lib/utils/setupExitSignals.js +0 -25
- package/lib/utils/tryParseInt.js +0 -13
- package/lib/utils/updateCompiler.js +0 -14
package/README.md
CHANGED
|
@@ -55,72 +55,123 @@ The easiest way to use it is with the [webpack CLI](https://webpack.js.org/api/c
|
|
|
55
55
|
`webpack.config.js` is, run:
|
|
56
56
|
|
|
57
57
|
```console
|
|
58
|
-
|
|
58
|
+
npx webpack serve
|
|
59
59
|
```
|
|
60
60
|
|
|
61
61
|
Following options are available with `webpack serve`:
|
|
62
62
|
|
|
63
63
|
```
|
|
64
|
-
Usage: webpack serve|s [entries...] [options]
|
|
64
|
+
Usage: webpack serve|server|s [entries...] [options]
|
|
65
|
+
|
|
66
|
+
Run the webpack dev server.
|
|
65
67
|
|
|
66
68
|
Options:
|
|
67
|
-
-c, --config <value...>
|
|
68
|
-
--config-name <value...>
|
|
69
|
-
-m, --merge
|
|
70
|
-
--env <value...>
|
|
71
|
-
--node-env <value>
|
|
72
|
-
--progress [value]
|
|
73
|
-
-j, --json [value]
|
|
74
|
-
-d, --devtool <value>
|
|
75
|
-
--no-devtool
|
|
76
|
-
--entry <value...>
|
|
77
|
-
--mode <value>
|
|
78
|
-
--name <value>
|
|
79
|
-
-o, --output-path <value>
|
|
80
|
-
--stats [value]
|
|
81
|
-
--no-stats
|
|
82
|
-
-t, --target <value...>
|
|
83
|
-
--no-target
|
|
84
|
-
--watch-options-stdin
|
|
85
|
-
--no-watch-options-stdin
|
|
86
|
-
--
|
|
87
|
-
|
|
88
|
-
--
|
|
89
|
-
|
|
90
|
-
--
|
|
91
|
-
--no-
|
|
92
|
-
--
|
|
93
|
-
--
|
|
94
|
-
--
|
|
95
|
-
--no-
|
|
96
|
-
--
|
|
97
|
-
--no-
|
|
98
|
-
--client-
|
|
99
|
-
--no-client-
|
|
100
|
-
--client-
|
|
101
|
-
--no-client-
|
|
102
|
-
--
|
|
103
|
-
--
|
|
104
|
-
|
|
105
|
-
--
|
|
106
|
-
--
|
|
107
|
-
--
|
|
108
|
-
--
|
|
109
|
-
--client-
|
|
110
|
-
--
|
|
111
|
-
--
|
|
112
|
-
--compress
|
|
113
|
-
--
|
|
114
|
-
|
|
115
|
-
--
|
|
116
|
-
--
|
|
117
|
-
--
|
|
69
|
+
-c, --config <value...> Provide path to a webpack configuration file e.g. ./webpack.config.js.
|
|
70
|
+
--config-name <value...> Name of the configuration to use.
|
|
71
|
+
-m, --merge Merge two or more configurations using 'webpack-merge'.
|
|
72
|
+
--env <value...> Environment passed to the configuration when it is a function.
|
|
73
|
+
--node-env <value> Sets process.env.NODE_ENV to the specified value.
|
|
74
|
+
--progress [value] Print compilation progress during build.
|
|
75
|
+
-j, --json [value] Prints result as JSON or store it in a file.
|
|
76
|
+
-d, --devtool <value> Determine source maps to use.
|
|
77
|
+
--no-devtool Do not generate source maps.
|
|
78
|
+
--entry <value...> The entry point(s) of your application e.g. ./src/main.js.
|
|
79
|
+
--mode <value> Defines the mode to pass to webpack.
|
|
80
|
+
--name <value> Name of the configuration. Used when loading multiple configurations.
|
|
81
|
+
-o, --output-path <value> Output location of the file generated by webpack e.g. ./dist/.
|
|
82
|
+
--stats [value] It instructs webpack on how to treat the stats e.g. verbose.
|
|
83
|
+
--no-stats Disable stats output.
|
|
84
|
+
-t, --target <value...> Sets the build target e.g. node.
|
|
85
|
+
--no-target Negative 'target' option.
|
|
86
|
+
--watch-options-stdin Stop watching when stdin stream has ended.
|
|
87
|
+
--no-watch-options-stdin Do not stop watching when stdin stream has ended.
|
|
88
|
+
--allowed-hosts <value...> Allows to enumerate the hosts from which access to the dev server are allowed (useful when you are proxying
|
|
89
|
+
dev server, by default is 'auto').
|
|
90
|
+
--allowed-hosts-reset Clear all items provided in 'allowedHosts' configuration. Allows to enumerate the hosts from which access to
|
|
91
|
+
the dev server are allowed (useful when you are proxying dev server, by default is 'auto').
|
|
92
|
+
--bonjour Allows to broadcasts dev server via ZeroConf networking on start.
|
|
93
|
+
--no-bonjour Negative 'bonjour' option.
|
|
94
|
+
--no-client Negative 'client' option.
|
|
95
|
+
--client-logging <value> Allows to specify options for client script in the browser or disable client script.
|
|
96
|
+
--client-overlay Enables a full-screen overlay in the browser when there are compiler errors or warnings.
|
|
97
|
+
--no-client-overlay Negative 'client-overlay' option.
|
|
98
|
+
--client-overlay-errors Enables a full-screen overlay in the browser when there are compiler errors.
|
|
99
|
+
--no-client-overlay-errors Negative 'client-overlay-errors' option.
|
|
100
|
+
--client-overlay-warnings Enables a full-screen overlay in the browser when there are compiler warnings.
|
|
101
|
+
--no-client-overlay-warnings Negative 'client-overlay-warnings' option.
|
|
102
|
+
--client-progress Prints compilation progress in percentage in the browser.
|
|
103
|
+
--no-client-progress Negative 'client-progress' option.
|
|
104
|
+
--client-web-socket-transport <value> Allows to set custom web socket transport to communicate with dev server.
|
|
105
|
+
--client-web-socket-url <value> Allows to specify URL to web socket server (useful when you're proxying dev server and client script does
|
|
106
|
+
not always know where to connect to).
|
|
107
|
+
--client-web-socket-url-hostname <value> Tells clients connected to devServer to use the provided hostname.
|
|
108
|
+
--client-web-socket-url-pathname <value> Tells clients connected to devServer to use the provided path to connect.
|
|
109
|
+
--client-web-socket-url-password <value> Tells clients connected to devServer to use the provided password to authenticate.
|
|
110
|
+
--client-web-socket-url-port <value> Tells clients connected to devServer to use the provided port.
|
|
111
|
+
--client-web-socket-url-protocol <value> Tells clients connected to devServer to use the provided protocol.
|
|
112
|
+
--client-web-socket-url-username <value> Tells clients connected to devServer to use the provided username to authenticate.
|
|
113
|
+
--compress Enables gzip compression for everything served.
|
|
114
|
+
--no-compress Negative 'compress' option.
|
|
115
|
+
--history-api-fallback Allows to proxy requests through a specified index page (by default 'index.html'), useful for Single Page
|
|
116
|
+
Applications that utilise the HTML5 History API.
|
|
117
|
+
--no-history-api-fallback Negative 'history-api-fallback' option.
|
|
118
|
+
--host <value> Allows to specify a hostname to use.
|
|
119
|
+
--hot [value] Enables Hot Module Replacement.
|
|
120
|
+
--no-hot Negative 'hot' option.
|
|
121
|
+
--http2 Allows to serve over HTTP/2 using SPDY.
|
|
122
|
+
--no-http2 Negative 'http2' option.
|
|
123
|
+
--https Allows to configure the server's listening socket for TLS (by default, dev server will be served over HTTP).
|
|
124
|
+
--no-https Negative 'https' option.
|
|
125
|
+
--https-passphrase <value> Passphrase for a pfx file.
|
|
126
|
+
--https-request-cert Request for an SSL certificate.
|
|
127
|
+
--no-https-request-cert Negative 'https-request-cert' option.
|
|
128
|
+
--https-cacert <value> Path to an SSL CA certificate.
|
|
129
|
+
--https-key <value> Path to an SSL key.
|
|
130
|
+
--https-pfx <value> Path to an SSL pfx file.
|
|
131
|
+
--https-cert <value> Path to an SSL certificate.
|
|
132
|
+
--ipc [value] Listen to a unix socket.
|
|
133
|
+
--live-reload Enables reload/refresh the page(s) when file changes are detected (enabled by default).
|
|
134
|
+
--no-live-reload Negative 'live-reload' option.
|
|
135
|
+
--open [value...] Allows to configure dev server to open the browser(s) and page(s) after server had been started (set it to
|
|
136
|
+
true to open your default browser).
|
|
137
|
+
--no-open Negative 'open' option.
|
|
138
|
+
--open-target <value...> Opens specified page in browser.
|
|
139
|
+
--open-app-name <value...> Open specified browser.
|
|
140
|
+
--open-app <value...> Open specified browser.
|
|
141
|
+
--open-reset Clear all items provided in 'open' configuration. Allows to configure dev server to open the browser(s) and
|
|
142
|
+
page(s) after server had been started (set it to true to open your default browser).
|
|
143
|
+
--open-target-reset Clear all items provided in 'open.target' configuration. Opens specified page in browser.
|
|
144
|
+
--open-app-name-reset Clear all items provided in 'open.app.name' configuration. Open specified browser.
|
|
145
|
+
--port <value> Allows to specify a port to use.
|
|
146
|
+
--static [value...] Allows to configure options for serving static files from directory (by default 'public' directory).
|
|
147
|
+
--no-static Negative 'static' option.
|
|
148
|
+
--static-directory <value...> Directory for static contents.
|
|
149
|
+
--static-public-path <value...> The static files will be available in the browser under this public path.
|
|
150
|
+
--static-serve-index Tells dev server to use serveIndex middleware when enabled.
|
|
151
|
+
--no-static-serve-index Negative 'static-serve-index' option.
|
|
152
|
+
--static-watch Watches for files in static content directory.
|
|
153
|
+
--no-static-watch Negative 'static-watch' option.
|
|
154
|
+
--static-reset Clear all items provided in 'static' configuration. Allows to configure options for serving static files
|
|
155
|
+
from directory (by default 'public' directory).
|
|
156
|
+
--static-public-path-reset Clear all items provided in 'static.publicPath' configuration. The static files will be available in the
|
|
157
|
+
browser under this public path.
|
|
158
|
+
--watch-files <value...> Allows to configure list of globs/directories/files to watch for file changes.
|
|
159
|
+
--watch-files-reset Clear all items provided in 'watchFiles' configuration. Allows to configure list of globs/directories/files
|
|
160
|
+
to watch for file changes.
|
|
161
|
+
--web-socket-server <value> Allows to set web socket server and options (by default 'ws').
|
|
162
|
+
--no-web-socket-server Negative 'web-socket-server' option.
|
|
118
163
|
|
|
119
164
|
Global options:
|
|
120
|
-
--color
|
|
121
|
-
--no-color
|
|
122
|
-
-v, --version
|
|
123
|
-
-h, --help [verbose]
|
|
165
|
+
--color Enable colors on console.
|
|
166
|
+
--no-color Disable colors on console.
|
|
167
|
+
-v, --version Output the version number of 'webpack', 'webpack-cli' and 'webpack-dev-server' and commands.
|
|
168
|
+
-h, --help [verbose] Display help for commands and options.
|
|
169
|
+
|
|
170
|
+
To see list of all supported commands and options run 'webpack --help=verbose'.
|
|
171
|
+
|
|
172
|
+
Webpack documentation: https://webpack.js.org/.
|
|
173
|
+
CLI documentation: https://webpack.js.org/api/cli/.
|
|
174
|
+
Made with ♥ by the webpack team.
|
|
124
175
|
```
|
|
125
176
|
|
|
126
177
|
_**Note**: For more information on above options explore this [link](https://webpack.js.org/configuration/dev-server/)._
|
|
@@ -142,7 +193,7 @@ script as such:
|
|
|
142
193
|
And run the following in your terminal/console:
|
|
143
194
|
|
|
144
195
|
```console
|
|
145
|
-
npm run
|
|
196
|
+
npm run serve
|
|
146
197
|
```
|
|
147
198
|
|
|
148
199
|
NPM will automagically reference the binary in `node_modules` for you, and
|