Releases: webpack/webpack-dev-server
Releases · webpack/webpack-dev-server
v4.1.0
v4.0.0
v4.0.0-rc.1
4.0.0-rc.1 (2021-08-17)
Notes:
- migration guide from v3 to v4 can be found here
Features
Bug Fixes
- fix usage legacy API (#3660) (c4678bc)
- proxy logging and allow to pass options without the
target
option (#3651) (6e2cbde) - render ansi formatted error messages correctly in overlay (#3579) (9313454)
- use value of the
infastructureLogging.level
option by default forclient.logging
. (#3613) (c9ccc96) - schema for the
host
option (#3549) (7200d31) - show deprecation warning for incorrect usage of Node.js API (#3563) (62b21ff)
v4.0.0-rc.0
4.0.0-rc.0 (2021-07-19)
Notes:
- migration guide from v3 to v4 can be found here
⚠ BREAKING CHANGES
- rename
client.transport
toclient.webSocketTransport
- move web socket client to web socket server class, i.e. to get web socket clients use
this.webSocketServer.clients
- remove entry options (i.e.
hotEntry
andneedClientEntry
) in favor manual setup entries (#3494) - you need to reset CLI options using
reset
option, please look them inwebpack serve --help
host
andport
options can't benull
or empty string
Features
- allow to close overlay in browser (#3433) (307f2e7)
- add port
auto
(#3297) (437c8d3) - added
<url>
pattern for open and allow to use multiple browsers (#3496) (7c7ccf9) - allow string value for
client.webSocketURL.port
(#3354) (f5e7f8f) - allow to disable web socket server using
webSocketServer: false
(f62f20f) - allow
username
andpassword
in clientURL (#3452) (a7225d5) - display documentation links on errors (#3512) (54790ab)
- enable
compress
by default (#3303) (4d251b5) - implement the
client.webSocketURL.protocol
option (#3380) (8998d6b) - the
ipc
option was added for unix socket (#3479) (b559738) - support
Function
in headers option (#3267) (28f9597)
Bug Fixes
- allow to use
80
port for dev server (#3487) (22f18eb) - avoid duplicate
App updated. Recompiling...
(#3488) (a2e3ead) - do not allow empty string for
port
(#3372) (8c53102) - don't allow empty array for
allowedHosts
option (#3451) (17aa345) - get rid of Symbol core-js polyfill (#3535) (7afe3d2)
- the
host
option can't benull
or empty string (#3352) (216b0d3) - improve message for static content changes (#3289) (970a7d7)
- improve processing of CLI flags (#3313) (32bc877)
- rename
firewall
option toallowedHosts
option (#3345) (81e4e55) - pass own logger in historyApiFallback (#3373) (3ba2fa5)
- polling usage in watchFiles option (#3366) (2afb223)
- postpone initialize (#3467) (80087de)
- regression with
port
andbonjour
(c2805fe) - rename
path
topathname
forclient.webSocketURL
(#3466) (fd63e02) - respect
logLevel
andlogProvider
option for proxy (#3257) (199baec) - show plugin name in progress log (#3337) (b8a0932)
v4.0.0-beta.3
4.0.0-beta.3 (2021-05-06)
Notes
Don't worry about a lot of changes, before the stable release, we will list all the changes and what you should do to migrate
⚠ BREAKING CHANGES
- the
https.ca
option was removed in favor thehttps.cacert
option - the
dev
option was renamed todevMiddleware
- the
client.overlay
option istrue
by default and show warnings by default - use server port for websocket connection by default, if you proxied
webpack-dev-server
, please updatewebpack-cli
tov4.7.0
(#3185) (0c3f817) - minimum supported Node.js version is
12.13.0
Features
- added
https.cacert
(#3240) (b212a2c) - added more CLI options, please run
webpack server --help
to look at them (#3238) (469e558) - support
bonjour
options (#3202) (5534583)
Bug Fixes
- improve warning message for
open
(#3191) (d473fd9) - respect the
client.logging
option for HMR logging (#3159) (6f3c6ba) - respect
client.needClientEntry
andclient.needHotEntry
options (#3178) (a2b6db9) - overlay with warnings (#3215) (7e18161)
- help description for options
- error description for options
- improve warning message for the
open
option
v4.0.0-beta.2
4.0.0-beta.2 (2021-04-06)
⚠ BREAKING CHANGES
- the
openPage
option and the--open-page
CLI option were removed in favor{ open: ['/my-page', '/my-other-page/'] }
for Node.js API and--open-target [URL]
(without[URL]
dev server will open a browser using thehost
option value) and--open-app <browser>
for CLI - the
useLocalIp
option was removed in favor{ host: 'local-ip' }
, alternative you can provide values:local-ipv4
for IPv4 andlocal-ipv6
for IPv6 stdin
option was removed in favor--watch-options-stdin
injectClient
andinjectHot
was removed in favorclient.needClientEntry
andclient.needHotEntry
Features
- added the
watchFiles
option, now you can reload server on file changes, for example{ watchFiles: ['src/**/*.php', 'public/**/*'] }
(#3136) (d73213a) - added more CLI options, please run
webpack server --help
(#3148) (03a2b27) - enable overlay by default (#3108) (5e05e48)
- you can specify multiple targets and browsers for the
open
option, i.e.{ open: { target: ['/my-page', '/my-other-page'], app: ['google-chrome', '--incognito'] } }
(e3c2683)
Bug Fixes
-
/webpack-dev-server
url shows list of files (#3101) (b3374c3) -
dev server client compatibility with
IE11
/IE10
/IE9
(#3129) (1e3e656)- For
IE11
/IE10
you need polyfillfetch()
andPromise
, example:
module.exports = { entry: { entry: [ 'whatwg-fetch', 'core-js/features/promise', './entry.js' ], }, };
- For
IE9
you need polyfillfetch()
andPromise
and usesockjs
for communications (becauseWebSocket
is not supported), example:
module.exports = { entry: { entry: [ 'whatwg-fetch', 'core-js/features/promise', './entry.js' ], }, devServer: { transportMode: 'sockjs', }, };
IE8 is not supported
- For
-
reduce number of
dependencies
v4.0.0-beta.1
4.0.0-beta.1 (2021-03-23)
⚠ BREAKING CHANGES
--hot-only
option was removed- default value of the
static
option ispath.resolve(process.cwd(), 'public')
, previouslypath.resolve(process.cwd(), 'static')
- the
overlay
option was moved into theclient
option
Features
- add more negative flags -
--no-https
,--no-http2
,--no-compress
and--no-history-api-fallback
(#3070) (ebc966f) - allow
Boolean
type for the--firewall
option (#3041) (6711c1d) - improve output for localhost and fix open (#2892) (9e65c24)
- improve output for IPv4 and IPv6 (#3092) (f362665)
Bug Fixes
- allow to open browser with
--open-page
(#3032) (581ee07) - content security policy issue in client log (2de2e01)
- empty and multiple entries support (#2920) (45f6592)
- improve descriptions for CLI options (#3021) (7d339d4)
- improve descriptions for negative flags (#3029) (2e2190a)
- multi compiler mode with proxy (#2905) (247a92b)
- remove double brackets from the ws url when using raw IPv6 address (#2951) (2ec8160)
- show correct url in output status (#3013) (06b3d91)
- show detailed error in overlay (ba01b05)
- support
file:
andchrome-extension:
protocols in client (#2954) (163bdce) - warnings in overlay (#3054) (6144c8d)
- webpack-cli installation message (#2955) (b9ce07f)
v3.11.2
v3.11.1
v4.0.0-beta.0
4.0.0-beta.0 (2020-11-27)
⚠ BREAKING CHANGES
- drop support
Node.js@6
andNode.js@8
, minimum supportedNode.js
version isNode@10
- the
hot
option istrue
by default - the
hotOnly
option was removed, if you need hot only mode, usehot: 'only'
value - the default
transportMode
is switched fromsockjs
tows
(IE 11 and other old browsers doesn't support WebSocket, setsockjs
value fortransportMode
if you need supports IE 11) before
,after
andsetup
were removed in favoronBeforeSetupMiddleware
(previouslybefore
) andonAfterSetupMiddleware
options (previouslyafter
)- the
clientOptions
was renamed to theclient
option - the
key
,cert
,pfx
,pfx-passphrase
,cacert
,ca
andrequestCert
options were moved tohttps
options, please usehttps.{key|cert|pfx|passphrase|requestCert|cacert|ca|requestCert}
- the
sockHost
,sockPath
andsockPort
options were removed inclient
option - the
inline
option (iframe
live mode) was removed - the
lazy
andfilename
options were removed - the
features
option was removed - the
log
,logLevel
,logTime
,noInfo
,quiet
,reporter
andwarn
options were removed in favor of built-in webpack logger, please read this to enable and setup logging output - the
fs
,index
,mimeTypes
,publicPath
,serverSideRender
, andwriteToDisk
options were moved in thedev
option (webpack-dev-middleware
options) - updating
webpack-dev-middleware
to v4, which includes many breaking options changes, please read - the
stats
option was removed, please use thestats
option fromwebpack.config.js
- the
socket
option was removed - the
contentBase
,contentBasePublicPath
,serveIndex
,staticOptions
,watchContentBase
,watchOptions
were removed in favor of thestatic
option - the
disableHostCheck
andallowedHosts
options were removed in favor of thefirewall
option server.listen()
will find free port if theport
is not set and theport
argument is not passed, also print a warning if theport
option and theport
argument passed toserver.listen()
are different- the
progress
option is moved to theclient
option, setclient: {progress: true}
- the
profile
option was removed, to print profile data, setclient: { progress: 'profile' }
- client uses the port of the current location (
location.port
, equivalent tosockPort: 'location'
), by default. To get previously behavior, set theclient.port
with the port you'd like to set - client uses the hostname of the current location (
location.hostname
), by default. To get previously behavior, set theclient.host
with the hostname you'd like to set
Features
- compatibility with
webpack@5
- compatibility with
webpack-cli@4
- added the
setupExitSignals
option, it takes a boolean and if true (default on CLI), the server will close and exit the process on SIGINT and SIGTERM - update
chokidar
to v3
Notes
Unfortunately, due to the huge amount of changes it is very difficult to display all changes in a convenient form. Therefore, we offer you a couple of popular examples (feel free to send a PR with more examples).
static
Previously contentBase
, contentBasePublicPath
, serveIndex
, staticOptions
, watchContentBase
and watchOptions
module.exports = {
// ...
devServer: {
// Can be:
// static: path.resolve(__dirname, 'static')
// static: false
static: [
// Simple example
path.resolve(__dirname, 'static'),
// Complex example
{
directory: path.resolve(__dirname, 'static'),
staticOptions: {},
// Don't be confused with `dev.publicPath`, it is `publicPath` for static directory
// Can be:
// publicPath: ['/static-public-path-one/', '/static-public-path-two/'],
publicPath: '/static-public-path/',
// Can be:
// serveIndex: {} (options for the `serveIndex` option you can find https://github.com/expressjs/serve-index)
serveIndex: true,
// Can be:
// watch: {} (options for the `watch` option you can find https://github.com/paulmillr/chokidar)
watch: true,
},
],
},
};
publicPath
module.exports = {
// ...
devServer: {
dev: {
publicPath: '/publicPathForDevServe',
},
},
};
firewall
Previously disableHostCheck
and allowedHosts
module.exports = {
// ...
devServer: {
// Can be
// firewall: ['192.168.0.1', 'domain.com']
firewall: false,
},
};
logging
module.exports = {
// ...
infrastructureLogging: {
// Only warnings and errors
// level: 'none' disable logging
// Please read https://webpack.js.org/configuration/other-options/#infrastructurelogginglevel
level: 'warn',
},
};