v4.0.0-beta.0
alexander-akait
released this
27 Nov 17:29
·
1518 commits
to master
since this release
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',
},
};