Update Webpack Dev Server 4.0.0-beta.2

In order to better promote the adaptation of Webpack 5 and the improvement of business, the following will be described according to some improvements after the webpack ecological update is connected to EMP

  • After the new version is addedopenMore choices
  • deleteuseLocalIpThis product has been used from start to finishlocal-ipTo make it easier to open local IPmodule federationLower collaborative developmentFinally, you don't have to write IP to emp-config
  • watchFilesFacilitates debugging of non-JS JSON file updates
  • More below, detailed code access

⚠ product CHANGES

  • Removed for node.js APIopenPageOptions and--open-pageCLI option to{open: ['/ my-page', '/ my-other-page /']}To replace. and--open-target [URL](no[URL]The development server will usehostOption values open browser) and--open-app <browser>for CLI
  • Delete theuseLocalIpOption to support{host: 'the local IP -'}, the following values can also be provided:local-ipv4Used for IPv4,local-ipv6Used for IPv6.
  • stdinOption has been removed--watch-options-stdinsupport
  • In order to supportclient.needClientEntryandclient.needHotEntryAnd delete theinjectClientandinjectHot.

Features

  • addedwatchFilesOption, now you can reload the server when a file changes, for example{watchFiles: ['/SRC / * * *. PHP ', 'public / / * * *]} (# 3136) (d73213a)
  • Added more CLI options, please runwebpack server --help (# 3148) (03a2b27)
  • Default startup overlay (#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 display file list (#3101) (b3374c3)

  • Development server client compatible with IE11/IE10/IE9 (#3129)

    • forIE11 /IE10You need polyfillThe fetch ()andPromise, such as:
    module.exports = {
      entry: {
        entry: [
          'whatwg-fetch'.'core-js/features/promise'.'./entry.js'],}};Copy the code
    • forIE9You need polyfillThe fetch ()andPromiseAnd usesockjsCommunicate (because not supportedWebSocket), for example:
    module.exports = {
      entry: {
        entry: [
          'whatwg-fetch'.'core-js/features/promise'.'./entry.js'],},devServer: {
        transportMode: 'sockjs',}};Copy the code

    Internet explorer does not support

  • Hostname resolution (#3128) (cd39491)

  • Improved CLI options (#3151) (09FA827)

  • Description of invalid option output (#3154) (2e02978)

  • prefer to open the host option (#3115) (7e525eb)

  • Reduce the number of dependencies