Releases: webpack/webpack-dev-server
Releases · webpack/webpack-dev-server
v3.11.1
v4.0.0-beta.0
4.0.0-beta.0 (2020-11-27)
⚠ BREAKING CHANGES
- drop support
Node.js@6andNode.js@8, minimum supportedNode.jsversion isNode@10 - the
hotoption istrueby default - the
hotOnlyoption was removed, if you need hot only mode, usehot: 'only'value - the default
transportModeis switched fromsockjstows(IE 11 and other old browsers doesn't support WebSocket, setsockjsvalue fortransportModeif you need supports IE 11) before,afterandsetupwere removed in favoronBeforeSetupMiddleware(previouslybefore) andonAfterSetupMiddlewareoptions (previouslyafter)- the
clientOptionswas renamed to theclientoption - the
key,cert,pfx,pfx-passphrase,cacert,caandrequestCertoptions were moved tohttpsoptions, please usehttps.{key|cert|pfx|passphrase|requestCert|cacert|ca|requestCert} - the
sockHost,sockPathandsockPortoptions were removed inclientoption - the
inlineoption (iframelive mode) was removed - the
lazyandfilenameoptions were removed - the
featuresoption was removed - the
log,logLevel,logTime,noInfo,quiet,reporterandwarnoptions were removed in favor of built-in webpack logger, please read this to enable and setup logging output - the
fs,index,mimeTypes,publicPath,serverSideRender, andwriteToDiskoptions were moved in thedevoption (webpack-dev-middlewareoptions) - updating
webpack-dev-middlewareto v4, which includes many breaking options changes, please read - the
statsoption was removed, please use thestatsoption fromwebpack.config.js - the
socketoption was removed - the
contentBase,contentBasePublicPath,serveIndex,staticOptions,watchContentBase,watchOptionswere removed in favor of thestaticoption - the
disableHostCheckandallowedHostsoptions were removed in favor of thefirewalloption server.listen()will find free port if theportis not set and theportargument is not passed, also print a warning if theportoption and theportargument passed toserver.listen()are different- the
progressoption is moved to theclientoption, setclient: {progress: true} - the
profileoption 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.portwith 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.hostwith the hostname you'd like to set
Features
- compatibility with
webpack@5 - compatibility with
webpack-cli@4 - added the
setupExitSignalsoption, it takes a boolean and if true (default on CLI), the server will close and exit the process on SIGINT and SIGTERM - update
chokidarto 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',
},
};