code:
[![npm][npm]][npm-url]
[![node][node]][node-url]
[![tests][tests]][tests-url]
[![coverage][cover]][cover-url]
[![chat][chat]][chat-url]
[![downloads][downloads]][npm-url]
[![contributors][contributors]][contributors-url]

# webpack-dev-server

Use [webpack](https://webpack.js.org) with a development server that provides
live reloading. This should be used for **development only**.

It uses [webpack-dev-middleware][middleware-url] under the hood, which provides
fast in-memory access to the webpack assets.

## Table of Contents

- [Getting Started](#getting-started)
- [Usage](#usage)
  - [With the CLI](#with-the-cli)
  - [With NPM Scripts](#with-npm-scripts)
  - [With the API](#with-the-api)
  - [With TypeScript](#with-typescript)
  - [The Result](#the-result)
- [Browser Support](#browser-support)
- [Support](#support)
- [Contributing](#contributing)
- [Attribution](#attribution)
- [License](#license)

## Getting Started

First things first, install the module:

```console
npm install webpack-dev-server --save-dev
```

or

```console
yarn add -D webpack-dev-server
```

or

```console
pnpm add -D webpack-dev-server
```

_Note: While you can install and run webpack-dev-server globally, we recommend
installing it locally. webpack-dev-server will always use a local installation
over a global one._

## Usage

There are two main, recommended methods of using the module:

### With the CLI

The easiest way to use it is with the [webpack CLI](https://webpack.js.org/api/cli/). In the directory where your
`webpack.config.js` is, run:

```console
npx webpack serve
```

Following options are available with `webpack serve`:

```
Usage: webpack serve|server|s [entries...] [options]

Run the webpack dev server.

Options:
  -c, --config <value...>                             Provide path to a webpack configuration file e.g. ./webpack.config.js.
  --config-name <value...>                            Name of the configuration to use.
  -m, --merge                                         Merge two or more configurations using 'webpack-merge'.
  --env <value...>                                    Environment passed to the configuration when it is a function.
  --node-env <value>                                  Sets process.env.NODE_ENV to the specified value.
  --progress [value]                                  Print compilation progress during build.
  -j, --json [value]                                  Prints result as JSON or store it in a file.
  -d, --devtool <value>                               Determine source maps to use.
  --no-devtool                                        Do not generate source maps.
  --entry <value...>                                  The entry point(s) of your application e.g. ./src/main.js.
  --mode <value>                                      Defines the mode to pass to webpack.
  --name <value>                                      Name of the configuration. Used when loading multiple configurations.
  -o, --output-path <value>                           Output location of the file generated by webpack e.g. ./dist/.
  --stats [value]                                     It instructs webpack on how to treat the stats e.g. verbose.
  --no-stats                                          Disable stats output.
  -t, --target <value...>                             Sets the build target e.g. node.
  --no-target                                         Negative 'target' option.
  --watch-options-stdin                               Stop watching when stdin stream has ended.
  --no-watch-options-stdin                            Do not stop watching when stdin stream has ended.
  --allowed-hosts <value...>                          Allows to enumerate the hosts from which access to the dev server are allowed (useful when you are proxying dev server, by default is 'auto').
  --allowed-hosts-reset                               Clear all items provided in 'allowedHosts' configuration. Allows to enumerate the hosts from which access to the dev server are allowed (useful when you are proxying dev server, by default is 'auto').
  --bonjour                                           Allows to broadcasts dev server via ZeroConf networking on start.
  --no-bonjour                                        Disallows to broadcasts dev server via ZeroConf networking on start.
  --no-client                                         Disables client script.
  --client-logging <value>                            Allows to set log level in the browser.
  --client-overlay                                    Enables a full-screen overlay in the browser when there are compiler errors or warnings.
  --no-client-overlay                                 Disables the full-screen overlay in the browser when there are compiler errors or warnings.
  --client-overlay-errors                             Enables a full-screen overlay in the browser when there are compiler errors.
  --no-client-overlay-errors                          Disables the full-screen overlay in the browser when there are compiler errors.
  --client-overlay-warnings                           Enables a full-screen overlay in the browser when there are compiler warnings.
  --no-client-overlay-warnings                        Disables the full-screen overlay in the browser when there are compiler warnings.
  --client-overlay-trusted-types-policy-name <value>  The name of a Trusted Types policy for the overlay. Defaults to 'webpack-dev-server#overlay'.
  --client-progress                                   Prints compilation progress in percentage in the browser.
  --no-client-progress                                Does not print compilation progress in percentage in the browser.
  --client-reconnect [value]                          Tells dev-server the number of times it should try to reconnect the client.
  --no-client-reconnect                               Tells dev-server to not to try to reconnect the client.
  --client-web-socket-transport <value>               Allows to set custom web socket transport to communicate with dev server.
  --client-web-socket-url <value>                     Allows to specify URL to web socket server (useful when you're proxying dev server and client script does not always know where to connect to).
  --client-web-socket-url-hostname <value>            Tells clients connected to devServer to use the provided hostname.
  --client-web-socket-url-pathname <value>            Tells clients connected to devServer to use the provided path to connect.
  --client-web-socket-url-password <value>            Tells clients connected to devServer to use the provided password to authenticate.
  --client-web-socket-url-port <value>                Tells clients connected to devServer to use the provided port.
  --client-web-socket-url-protocol <value>            Tells clients connected to devServer to use the provided protocol.
  --client-web-socket-url-username <value>            Tells clients connected to devServer to use the provided username to authenticate.
  --compress                                          Enables gzip compression for everything served.
  --no-compress                                       Disables gzip compression for everything served.
  --history-api-fallback                              Allows to proxy requests through a specified index page (by default 'index.html'), useful for Single Page Applications that utilise the HTML5 History API.
  --no-history-api-fallback                           Disallows to proxy requests through a specified index page.
  --host <value>                                      Allows to specify a hostname to use.
  --hot [value]                                       Enables Hot Module Replacement.
  --no-hot                                            Disables Hot Module Replacement.
  --http2                                             Allows to serve over HTTP/2 using SPDY. Deprecated, use the `server` option.
  --no-http2                                          Does not serve over HTTP/2 using SPDY.
  --https                                             Allows to configure the server's listening socket for TLS (by default, dev server will be served over HTTP). Deprecated, use the `server` option.
  --no-https                                          Disallows to configure the server's listening socket for TLS (by default, dev server will be served over HTTP).
  --https-passphrase <value>                          Passphrase for a pfx file. Deprecated, use the `server.options.passphrase` option.
  --https-request-cert                                Request for an SSL certificate. Deprecated, use the `server.options.requestCert` option.
  --no-https-request-cert                             Does not request for an SSL certificate.
  --https-ca <value...>                               Path to an SSL CA certificate or content of an SSL CA certificate. Deprecated, use the `server.options.ca` option.
  --https-ca-reset                                    Clear all items provided in 'https.ca' configuration. Path to an SSL CA certificate or content of an SSL CA certificate. Deprecated, use the `server.options.ca` option.
  --https-cacert <value...>                           Path to an SSL CA certificate or content of an SSL CA certificate. Deprecated, use the `server.options.ca` option.
  --https-cacert-reset                                Clear all items provided in 'https.cacert' configuration. Path to an SSL CA certificate or content of an SSL CA certificate. Deprecated, use the `server.options.ca` option.
  --https-cert <value...>                             Path to an SSL certificate or content of an SSL certificate. Deprecated, use the `server.options.cert` option.
  --https-cert-reset                                  Clear all items provided in 'https.cert' configuration. Path to an SSL certificate or content of an SSL certificate. Deprecated, use the `server.options.cert` option.
  --https-crl <value...>                              Path to PEM formatted CRLs (Certificate Revocation Lists) or content of PEM formatted CRLs (Certificate Revocation Lists). Deprecated, use the `server.options.crl` option.
  --https-crl-reset                                   Clear all items provided in 'https.crl' configuration. Path to PEM formatted CRLs (Certificate Revocation Lists) or content of PEM formatted CRLs (Certificate Revocation Lists). Deprecated, use the `server.options.crl` option.
  --https-key <value...>                              Path to an SSL key or content of an SSL key. Deprecated, use the `server.options.key` option.
  --https-key-reset                                   Clear all items provided in 'https.key' configuration. Path to an SSL key or content of an SSL key. Deprecated, use the `server.options.key` option.
  --https-pfx <value...>                              Path to an SSL pfx file or content of an SSL pfx file. Deprecated, use the `server.options.pfx` option.
  --https-pfx-reset                                   Clear all items provided in 'https.pfx' configuration. Path to an SSL pfx file or content of an SSL pfx file. Deprecated, use the `server.options.pfx` option.
  --ipc [value]                                       Listen to a unix socket.
  --live-reload                                       Enables reload/refresh the page(s) when file changes are detected (enabled by default).
  --no-live-reload                                    Disables reload/refresh the page(s) when file changes are detected (enabled by default).
  --magic-html                                        Tells dev-server whether to enable magic HTML routes (routes corresponding to your webpack output, for example '/main' for 'main.js').
  --no-magic-html                                     Disables magic HTML routes (routes corresponding to your webpack output, for example '/main' for 'main.js').
  --open [value...]                                   Allows to configure dev server to open the browser(s) and page(s) after server had been started (set it to true to open your default browser).
  --no-open                                           Does not open the default browser.
  --open-target <value...>                            Opens specified page in browser.
  --open-app-name <value...>                          Open specified browser.
  --open-app <value...>                               Open specified browser. Deprecated: please use '--open-app-name'.
  --open-reset                                        Clear all items provided in 'open' configuration. Allows to configure dev server to open the browser(s) and page(s) after server had been started (set it to true to open your default browser).
  --open-target-reset                                 Clear all items provided in 'open.target' configuration. Opens specified page in browser.
  --open-app-name-reset                               Clear all items provided in 'open.app.name' configuration. Open specified browser.
  --port <value>                                      Allows to specify a port to use.
  --server-type <value>                               Allows to set server and options (by default 'http').
  --server-options-passphrase <value>                 Passphrase for a pfx file.
  --server-options-request-cert                       Request for an SSL certificate.
  --no-server-options-request-cert                    Does not request for an SSL certificate.
  --server-options-ca <value...>                      Path to an SSL CA certificate or content of an SSL CA certificate.
  --server-options-ca-reset                           Clear all items provided in 'server.options.ca' configuration. Path to an SSL CA certificate or content of an SSL CA certificate.
  --server-options-cacert <value...>                  Path to an SSL CA certificate or content of an SSL CA certificate. Deprecated, use the `server.options.ca` option.
  --server-options-cacert-reset                       Clear all items provided in 'server.options.cacert' configuration. Path to an SSL CA certificate or content of an SSL CA certificate. Deprecated, use the `server.options.ca` option.
  --server-options-cert <value...>                    Path to an SSL certificate or content of an SSL certificate.
  --server-options-cert-reset                         Clear all items provided in 'server.options.cert' configuration. Path to an SSL certificate or content of an SSL certificate.
  --server-options-crl <value...>                     Path to PEM formatted CRLs (Certificate Revocation Lists) or content of PEM formatted CRLs (Certificate Revocation Lists).
  --server-options-crl-reset                          Clear all items provided in 'server.options.crl' configuration. Path to PEM formatted CRLs (Certificate Revocation Lists) or content of PEM formatted CRLs (Certificate Revocation Lists).
  --server-options-key <value...>                     Path to an SSL key or content of an SSL key.
  --server-options-key-reset                          Clear all items provided in 'server.options.key' configuration. Path to an SSL key or content of an SSL key.
  --server-options-pfx <value...>                     Path to an SSL pfx file or content of an SSL pfx file.
  --server-options-pfx-reset                          Clear all items provided in 'server.options.pfx' configuration. Path to an SSL pfx file or content of an SSL pfx file.
  --static [value...]                                 Allows to configure options for serving static files from directory (by default 'public' directory).
  --no-static                                         Disallows to configure options for serving static files from directory.
  --static-directory <value...>                       Directory for static contents.
  --static-public-path <value...>                     The static files will be available in the browser under this public path.
  --static-serve-index                                Tells dev server to use serveIndex middleware when enabled.
  --no-static-serve-index                             Does not tell dev server to use serveIndex middleware.
  --static-watch                                      Watches for files in static content directory.
  --no-static-watch                                   Does not watch for files in static content directory.
  --static-reset                                      Clear all items provided in 'static' configuration. Allows to configure options for serving static files from directory (by default 'public' directory).
  --static-public-path-reset                          Clear all items provided in 'static.publicPath' configuration. The static files will be available in the browser under this public path.
  --watch-files <value...>                            Allows to configure list of globs/directories/files to watch for file changes.
  --watch-files-reset                                 Clear all items provided in 'watchFiles' configuration. Allows to configure list of globs/directories/files to watch for file changes.
  --web-socket-server <value>                         Deprecated: please use '--web-socket-server-type' option. Allows to set web socket server and options (by default 'ws').
  --no-web-socket-server                              Disallows to set web socket server and options.
  --web-socket-server-type <value>                    Allows to set web socket server and options (by default 'ws').

Global options:
  --color                                             Enable colors on console.
  --no-color                                          Disable colors on console.
  -v, --version                                       Output the version number of 'webpack', 'webpack-cli' and 'webpack-dev-server' and commands.
  -h, --help [verbose]                                Display help for commands and options.

To see list of all supported commands and options run 'webpack --help=verbose'.

Webpack documentation: https://webpack.js.org/.
CLI documentation: https://webpack.js.org/api/cli/.
Made with ♥ by the webpack team.
```

> **Note**
>
> _Detailed documentation for above options is available on this [link](https://webpack.js.org/configuration/dev-server/)._

### With NPM Scripts

NPM package.json scripts are a convenient and useful means to run locally installed
binaries without having to be concerned about their full paths. Simply define a
script as such:

```json
{
  "scripts": {
    "serve": "webpack serve"
  }
}
```

And run the following in your terminal/console:

```console
npm run serve
```

NPM will automatically refer to the the binary in `node_modules` for you, and
execute the file or command.

### With the API

While it's recommended to run webpack-dev-server via the CLI, you may also choose to start a server via the API.

See the related [API documentation for `webpack-dev-server`](https://webpack.js.org/api/webpack-dev-server/).

### With TypeScript

If you use TypeScript in the webpack config, you'll need to properly type `devServer` property in order to avoid TS errors (e.g. `'devServer' does not exist in type 'Configuration'`). For that use either:

```ts
/// <reference path="node_modules/webpack-dev-server/types/lib/Server.d.ts"/>
import type { Configuration } from "webpack";

// Your logic
```

Or you can import the type from `webpack-dev-server`, i.e.

```ts
import type { Configuration as DevServerConfiguration } from "webpack-dev-server";
import type { Configuration } from "webpack";

const devServer: DevServerConfiguration = {};
const config: Configuration = { devServer };

// module.exports
export default config;
```

### The Result

Either method will start a server instance and begin listening for connections
from `localhost` on port `8080`.

webpack-dev-server is configured by default to support live-reload of files as
you edit your assets while the server is running.

See [**the documentation**][docs-url] for more use cases and options.

## Browser Support

While `webpack-dev-server` transpiles the client (browser) scripts to an ES5
state, the project only officially supports the _last two versions of major
browsers_. We simply don't have the resources to support every whacky
browser out there.

If you find a bug with an obscure / old browser, we would actively welcome a
Pull Request to resolve the bug.

## Support

We do our best to keep issues in the repository focused on bugs, features, and
needed modifications to the code for the module. Because of that, we ask users
with general support, "how-to", or "why isn't this working" questions to try one
of the other support channels that are available.

Your first-stop-shop for support for webpack-dev-server should be the excellent
[documentation][docs-url] for the module. If you see an opportunity for improvement
of those docs, please head over to the [webpack.js.org repo][wjo-url] and open a
pull request.

From there, we encourage users to visit the [webpack Gitter chat][chat-url] and
talk to the fine folks there. If your quest for answers comes up dry in chat,
head over to [StackOverflow][stack-url] and do a quick search or open a new
question. Remember; It's always much easier to answer questions that include your
`webpack.config.js` and relevant files!

If you're twitter-savvy you can tweet [#webpack][hash-url] with your question
and someone should be able to reach out and lend a hand.

If you have discovered a :bug:, have a feature suggestion, or would like to see
a modification, please feel free to create an issue on Github. _Note: The issue
template isn't optional, so please be sure not to remove it, and please fill it
out completely._

## Contributing

We welcome your contributions! Please have a read of [CONTRIBUTING.md](CONTRIBUTING.md) for more information on how to get involved.

## Attribution

This project is heavily inspired by [peerigon/nof5](https://github.com/peerigon/nof5).

## License

#### [MIT](./LICENSE)

[npm]: https://img.shields.io/npm/v/webpack-dev-server.svg
[npm-url]: https://npmjs.com/package/webpack-dev-server
[node]: https://img.shields.io/node/v/webpack-dev-server.svg
[node-url]: https://nodejs.org
[tests]: https://github.com/webpack/webpack-dev-server/workflows/webpack-dev-server/badge.svg
[tests-url]: https://github.com/webpack/webpack-dev-server/actions?query=workflow%3Awebpack-dev-server
[cover]: https://codecov.io/gh/webpack/webpack-dev-server/branch/master/graph/badge.svg
[cover-url]: https://codecov.io/gh/webpack/webpack-dev-server
[chat]: https://badges.gitter.im/webpack/webpack.svg
[chat-url]: https://gitter.im/webpack/webpack
[docs-url]: https://webpack.js.org/configuration/dev-server/#devserver
[hash-url]: https://twitter.com/search?q=webpack
[middleware-url]: https://github.com/webpack/webpack-dev-middleware
[stack-url]: https://stackoverflow.com/questions/tagged/webpack-dev-server
[uglify-url]: https://github.com/webpack-contrib/uglifyjs-webpack-plugin
[wjo-url]: https://github.com/webpack/webpack.js.org
[downloads]: https://img.shields.io/npm/dm/webpack-dev-server.svg
[contributors-url]: https://github.com/webpack/webpack-dev-server/graphs/contributors
[contributors]: https://img.shields.io/github/contributors/webpack/webpack-dev-server.svg


code:
"use strict";

module.exports = {
  "allowed-hosts": {
    configs: [
      {
        type: "string",
        multiple: true,
        description:
          "Allows to enumerate the hosts from which access to the dev server are allowed (useful when you are proxying dev server, by default is 'auto').",
        path: "allowedHosts[]",
      },
      {
        description:
          "Allows to enumerate the hosts from which access to the dev server are allowed (useful when you are proxying dev server, by default is 'auto').",
        multiple: false,
        path: "allowedHosts",
        type: "enum",
        values: ["auto", "all"],
      },
    ],
    description:
      "Allows to enumerate the hosts from which access to the dev server are allowed (useful when you are proxying dev server, by default is 'auto').",
    multiple: true,
    simpleType: "string",
  },
  "allowed-hosts-reset": {
    configs: [
      {
        type: "reset",
        multiple: false,
        description:
          "Clear all items provided in 'allowedHosts' configuration. Allows to enumerate the hosts from which access to the dev server are allowed (useful when you are proxying dev server, by default is 'auto').",
        path: "allowedHosts",
      },
    ],
    description:
      "Clear all items provided in 'allowedHosts' configuration. Allows to enumerate the hosts from which access to the dev server are allowed (useful when you are proxying dev server, by default is 'auto').",
    simpleType: "boolean",
    multiple: false,
  },
  bonjour: {
    configs: [
      {
        type: "boolean",
        multiple: false,
        description:
          "Allows to broadcasts dev server via ZeroConf networking on start.",
        negatedDescription:
          "Disallows to broadcasts dev server via ZeroConf networking on start.",
        path: "bonjour",
      },
    ],
    description:
      "Allows to broadcasts dev server via ZeroConf networking on start.",
    simpleType: "boolean",
    multiple: false,
  },
  client: {
    configs: [
      {
        description:
          "Allows to specify options for client script in the browser or disable client script.",
        negatedDescription: "Disables client script.",
        multiple: false,
        path: "client",
        type: "enum",
        values: [false],
      },
    ],
    description:
      "Allows to specify options for client script in the browser or disable client script.",
    multiple: false,
    simpleType: "boolean",
  },
  "client-logging": {
    configs: [
      {
        type: "enum",
        values: ["none", "error", "warn", "info", "log", "verbose"],
        multiple: false,
        description: "Allows to set log level in the browser.",
        path: "client.logging",
      },
    ],
    description: "Allows to set log level in the browser.",
    simpleType: "string",
    multiple: false,
  },
  "client-overlay": {
    configs: [
      {
        type: "boolean",
        multiple: false,
        description:
          "Enables a full-screen overlay in the browser when there are compiler errors or warnings.",
        negatedDescription:
          "Disables the full-screen overlay in the browser when there are compiler errors or warnings.",
        path: "client.overlay",
      },
    ],
    description:
      "Enables a full-screen overlay in the browser when there are compiler errors or warnings.",
    simpleType: "boolean",
    multiple: false,
  },
  "client-overlay-errors": {
    configs: [
      {
        type: "boolean",
        multiple: false,
        description:
          "Enables a full-screen overlay in the browser when there are compiler errors.",
        negatedDescription:
          "Disables the full-screen overlay in the browser when there are compiler errors.",
        path: "client.overlay.errors",
      },
    ],
    description:
      "Enables a full-screen overlay in the browser when there are compiler errors.",
    simpleType: "boolean",
    multiple: false,
  },
  "client-overlay-trusted-types-policy-name": {
    configs: [
      {
        description:
          "The name of a Trusted Types policy for the overlay. Defaults to 'webpack-dev-server#overlay'.",
        multiple: false,
        path: "client.overlay.trustedTypesPolicyName",
        type: "string",
      },
    ],
    description:
      "The name of a Trusted Types policy for the overlay. Defaults to 'webpack-dev-server#overlay'.",
    multiple: false,
    simpleType: "string",
  },
  "client-overlay-warnings": {
    configs: [
      {
        type: "boolean",
        multiple: false,
        description:
          "Enables a full-screen overlay in the browser when there are compiler warnings.",
        negatedDescription:
          "Disables the full-screen overlay in the browser when there are compiler warnings.",
        path: "client.overlay.warnings",
      },
    ],
    description:
      "Enables a full-screen overlay in the browser when there are compiler warnings.",
    simpleType: "boolean",
    multiple: false,
  },
  "client-overlay-runtime-errors": {
    configs: [
      {
        type: "boolean",
        multiple: false,
        description:
          "Enables a full-screen overlay in the browser when there are uncaught runtime errors.",
        negatedDescription:
          "Disables the full-screen overlay in the browser when there are uncaught runtime errors.",
        path: "client.overlay.runtimeErrors",
      },
    ],
    description:
      "Enables a full-screen overlay in the browser when there are uncaught runtime errors.",
    simpleType: "boolean",
    multiple: false,
  },
  "client-progress": {
    configs: [
      {
        type: "boolean",
        multiple: false,
        description:
          "Prints compilation progress in percentage in the browser.",
        negatedDescription:
          "Does not print compilation progress in percentage in the browser.",
        path: "client.progress",
      },
    ],
    description: "Prints compilation progress in percentage in the browser.",
    simpleType: "boolean",
    multiple: false,
  },
  "client-reconnect": {
    configs: [
      {
        type: "boolean",
        multiple: false,
        description:
          "Tells dev-server the number of times it should try to reconnect the client.",
        negatedDescription:
          "Tells dev-server to not to try to reconnect the client.",
        path: "client.reconnect",
      },
      {
        type: "number",
        multiple: false,
        description:
          "Tells dev-server the number of times it should try to reconnect the client.",
        path: "client.reconnect",
      },
    ],
    description:
      "Tells dev-server the number of times it should try to reconnect the client.",
    simpleType: "string",
    multiple: false,
  },
  "client-web-socket-transport": {
    configs: [
      {
        type: "enum",
        values: ["sockjs", "ws"],
        multiple: false,
        description:
          "Allows to set custom web socket transport to communicate with dev server.",
        path: "client.webSocketTransport",
      },
      {
        type: "string",
        multiple: false,
        description:
          "Allows to set custom web socket transport to communicate with dev server.",
        path: "client.webSocketTransport",
      },
    ],
    description:
      "Allows to set custom web socket transport to communicate with dev server.",
    simpleType: "string",
    multiple: false,
  },
  "client-web-socket-url": {
    configs: [
      {
        type: "string",
        multiple: false,
        description:
          "Allows to specify URL to web socket server (useful when you're proxying dev server and client script does not always know where to connect to).",
        path: "client.webSocketURL",
      },
    ],
    description:
      "Allows to specify URL to web socket server (useful when you're proxying dev server and client script does not always know where to connect to).",
    simpleType: "string",
    multiple: false,
  },
  "client-web-socket-url-hostname": {
    configs: [
      {
        type: "string",
        multiple: false,
        description:
          "Tells clients connected to devServer to use the provided hostname.",
        path: "client.webSocketURL.hostname",
      },
    ],
    description:
      "Tells clients connected to devServer to use the provided hostname.",
    simpleType: "string",
    multiple: false,
  },
  "client-web-socket-url-password": {
    configs: [
      {
        type: "string",
        multiple: false,
        description:
          "Tells clients connected to devServer to use the provided password to authenticate.",
        path: "client.webSocketURL.password",
      },
    ],
    description:
      "Tells clients connected to devServer to use the provided password to authenticate.",
    simpleType: "string",
    multiple: false,
  },
  "client-web-socket-url-pathname": {
    configs: [
      {
        type: "string",
        multiple: false,
        description:
          "Tells clients connected to devServer to use the provided path to connect.",
        path: "client.webSocketURL.pathname",
      },
    ],
    description:
      "Tells clients connected to devServer to use the provided path to connect.",
    simpleType: "string",
    multiple: false,
  },
  "client-web-socket-url-port": {
    configs: [
      {
        type: "number",
        multiple: false,
        description:
          "Tells clients connected to devServer to use the provided port.",
        path: "client.webSocketURL.port",
      },
      {
        description:
          "Tells clients connected to devServer to use the provided port.",
        multiple: false,
        path: "client.webSocketURL.port",
        type: "string",
      },
    ],
    description:
      "Tells clients connected to devServer to use the provided port.",
    simpleType: "string",
    multiple: false,
  },
  "client-web-socket-url-protocol": {
    configs: [
      {
        description:
          "Tells clients connected to devServer to use the provided protocol.",
        multiple: false,
        path: "client.webSocketURL.protocol",
        type: "enum",
        values: ["auto"],
      },
      {
        description:
          "Tells clients connected to devServer to use the provided protocol.",
        multiple: false,
        path: "client.webSocketURL.protocol",
        type: "string",
      },
    ],
    description:
      "Tells clients connected to devServer to use the provided protocol.",
    multiple: false,
    simpleType: "string",
  },
  "client-web-socket-url-username": {
    configs: [
      {
        type: "string",
        multiple: false,
        description:
          "Tells clients connected to devServer to use the provided username to authenticate.",
        path: "client.webSocketURL.username",
      },
    ],
    description:
      "Tells clients connected to devServer to use the provided username to authenticate.",
    simpleType: "string",
    multiple: false,
  },
  compress: {
    configs: [
      {
        type: "boolean",
        multiple: false,
        description: "Enables gzip compression for everything served.",
        negatedDescription: "Disables gzip compression for everything served.",
        path: "compress",
      },
    ],
    description: "Enables gzip compression for everything served.",
    simpleType: "boolean",
    multiple: false,
  },
  "history-api-fallback": {
    configs: [
      {
        type: "boolean",
        multiple: false,
        description:
          "Allows to proxy requests through a specified index page (by default 'index.html'), useful for Single Page Applications that utilise the HTML5 History API.",
        negatedDescription:
          "Disallows to proxy requests through a specified index page.",
        path: "historyApiFallback",
      },
    ],
    description:
      "Allows to proxy requests through a specified index page (by default 'index.html'), useful for Single Page Applications that utilise the HTML5 History API.",
    simpleType: "boolean",
    multiple: false,
  },
  host: {
    configs: [
      {
        description: "Allows to specify a hostname to use.",
        multiple: false,
        path: "host",
        type: "enum",
        values: ["local-ip", "local-ipv4", "local-ipv6"],
      },
      {
        description: "Allows to specify a hostname to use.",
        multiple: false,
        path: "host",
        type: "string",
      },
    ],
    description: "Allows to specify a hostname to use.",
    simpleType: "string",
    multiple: false,
  },
  hot: {
    configs: [
      {
        type: "boolean",
        multiple: false,
        description: "Enables Hot Module Replacement.",
        negatedDescription: "Disables Hot Module Replacement.",
        path: "hot",
      },
      {
        type: "enum",
        values: ["only"],
        multiple: false,
        description: "Enables Hot Module Replacement.",
        path: "hot",
      },
    ],
    description: "Enables Hot Module Replacement.",
    simpleType: "string",
    multiple: false,
  },
  http2: {
    configs: [
      {
        type: "boolean",
        multiple: false,
        description:
          "Allows to serve over HTTP/2 using SPDY. Deprecated, use the `server` option.",
        negatedDescription: "Does not serve over HTTP/2 using SPDY.",
        path: "http2",
      },
    ],
    description:
      "Allows to serve over HTTP/2 using SPDY. Deprecated, use the `server` option.",
    simpleType: "boolean",
    multiple: false,
  },
  https: {
    configs: [
      {
        type: "boolean",
        multiple: false,
        description:
          "Allows to configure the server's listening socket for TLS (by default, dev server will be served over HTTP). Deprecated, use the `server` option.",
        negatedDescription:
          "Disallows to configure the server's listening socket for TLS (by default, dev server will be served over HTTP).",
        path: "https",
      },
    ],
    description:
      "Allows to configure the server's listening socket for TLS (by default, dev server will be served over HTTP). Deprecated, use the `server` option.",
    simpleType: "boolean",
    multiple: false,
  },
  "https-ca": {
    configs: [
      {
        type: "string",
        multiple: true,
        description:
          "Path to an SSL CA certificate or content of an SSL CA certificate. Deprecated, use the `server.options.ca` option.",
        path: "https.ca[]",
      },
    ],
    description:
      "Path to an SSL CA certificate or content of an SSL CA certificate. Deprecated, use the `server.options.ca` option.",
    simpleType: "string",
    multiple: true,
  },
  "https-ca-reset": {
    configs: [
      {
        description:
          "Clear all items provided in 'https.ca' configuration. Path to an SSL CA certificate or content of an SSL CA certificate. Deprecated, use the `server.options.ca` option.",
        multiple: false,
        path: "https.ca",
        type: "reset",
      },
    ],
    description:
      "Clear all items provided in 'https.ca' configuration. Path to an SSL CA certificate or content of an SSL CA certificate. Deprecated, use the `server.options.ca` option.",
    multiple: false,
    simpleType: "boolean",
  },
  "https-cacert": {
    configs: [
      {
        type: "string",
        multiple: true,
        description:
          "Path to an SSL CA certificate or content of an SSL CA certificate. Deprecated, use the `server.options.ca` option.",
        path: "https.cacert[]",
      },
    ],
    description:
      "Path to an SSL CA certificate or content of an SSL CA certificate. Deprecated, use the `server.options.ca` option.",
    simpleType: "string",
    multiple: true,
  },
  "https-cacert-reset": {
    configs: [
      {
        description:
          "Clear all items provided in 'https.cacert' configuration. Path to an SSL CA certificate or content of an SSL CA certificate. Deprecated, use the `server.options.ca` option.",
        multiple: false,
        path: "https.cacert",
        type: "reset",
      },
    ],
    description:
      "Clear all items provided in 'https.cacert' configuration. Path to an SSL CA certificate or content of an SSL CA certificate. Deprecated, use the `server.options.ca` option.",
    multiple: false,
    simpleType: "boolean",
  },
  "https-cert": {
    configs: [
      {
        type: "string",
        multiple: true,
        description:
          "Path to an SSL certificate or content of an SSL certificate. Deprecated, use the `server.options.cert` option.",
        path: "https.cert[]",
      },
    ],
    description:
      "Path to an SSL certificate or content of an SSL certificate. Deprecated, use the `server.options.cert` option.",
    simpleType: "string",
    multiple: true,
  },
  "https-cert-reset": {
    configs: [
      {
        description:
          "Clear all items provided in 'https.cert' configuration. Path to an SSL certificate or content of an SSL certificate. Deprecated, use the `server.options.cert` option.",
        multiple: false,
        path: "https.cert",
        type: "reset",
      },
    ],
    description:
      "Clear all items provided in 'https.cert' configuration. Path to an SSL certificate or content of an SSL certificate. Deprecated, use the `server.options.cert` option.",
    multiple: false,
    simpleType: "boolean",
  },
  "https-crl": {
    configs: [
      {
        description:
          "Path to PEM formatted CRLs (Certificate Revocation Lists) or content of PEM formatted CRLs (Certificate Revocation Lists). Deprecated, use the `server.options.crl` option.",
        multiple: true,
        path: "https.crl[]",
        type: "string",
      },
    ],
    description:
      "Path to PEM formatted CRLs (Certificate Revocation Lists) or content of PEM formatted CRLs (Certificate Revocation Lists). Deprecated, use the `server.options.crl` option.",
    multiple: true,
    simpleType: "string",
  },
  "https-crl-reset": {
    configs: [
      {
        description:
          "Clear all items provided in 'https.crl' configuration. Path to PEM formatted CRLs (Certificate Revocation Lists) or content of PEM formatted CRLs (Certificate Revocation Lists). Deprecated, use the `server.options.crl` option.",
        multiple: false,
        path: "https.crl",
        type: "reset",
      },
    ],
    description:
      "Clear all items provided in 'https.crl' configuration. Path to PEM formatted CRLs (Certificate Revocation Lists) or content of PEM formatted CRLs (Certificate Revocation Lists). Deprecated, use the `server.options.crl` option.",
    multiple: false,
    simpleType: "boolean",
  },
  "https-key": {
    configs: [
      {
        type: "string",
        multiple: true,
        description:
          "Path to an SSL key or content of an SSL key. Deprecated, use the `server.options.key` option.",
        path: "https.key[]",
      },
    ],
    description:
      "Path to an SSL key or content of an SSL key. Deprecated, use the `server.options.key` option.",
    simpleType: "string",
    multiple: true,
  },
  "https-key-reset": {
    configs: [
      {
        description:
          "Clear all items provided in 'https.key' configuration. Path to an SSL key or content of an SSL key. Deprecated, use the `server.options.key` option.",
        multiple: false,
        path: "https.key",
        type: "reset",
      },
    ],
    description:
      "Clear all items provided in 'https.key' configuration. Path to an SSL key or content of an SSL key. Deprecated, use the `server.options.key` option.",
    multiple: false,
    simpleType: "boolean",
  },
  "https-passphrase": {
    configs: [
      {
        type: "string",
        multiple: false,
        description:
          "Passphrase for a pfx file. Deprecated, use the `server.options.passphrase` option.",
        path: "https.passphrase",
      },
    ],
    description:
      "Passphrase for a pfx file. Deprecated, use the `server.options.passphrase` option.",
    simpleType: "string",
    multiple: false,
  },
  "https-pfx": {
    configs: [
      {
        type: "string",
        multiple: true,
        description:
          "Path to an SSL pfx file or content of an SSL pfx file. Deprecated, use the `server.options.pfx` option.",
        path: "https.pfx[]",
      },
    ],
    description:
      "Path to an SSL pfx file or content of an SSL pfx file. Deprecated, use the `server.options.pfx` option.",
    simpleType: "string",
    multiple: true,
  },
  "https-pfx-reset": {
    configs: [
      {
        description:
          "Clear all items provided in 'https.pfx' configuration. Path to an SSL pfx file or content of an SSL pfx file. Deprecated, use the `server.options.pfx` option.",
        multiple: false,
        path: "https.pfx",
        type: "reset",
      },
    ],
    description:
      "Clear all items provided in 'https.pfx' configuration. Path to an SSL pfx file or content of an SSL pfx file. Deprecated, use the `server.options.pfx` option.",
    multiple: false,
    simpleType: "boolean",
  },
  "https-request-cert": {
    configs: [
      {
        type: "boolean",
        multiple: false,
        description:
          "Request for an SSL certificate. Deprecated, use the `server.options.requestCert` option.",
        negatedDescription: "Does not request for an SSL certificate.",
        path: "https.requestCert",
      },
    ],
    description:
      "Request for an SSL certificate. Deprecated, use the `server.options.requestCert` option.",
    simpleType: "boolean",
    multiple: false,
  },
  ipc: {
    configs: [
      {
        type: "string",
        multiple: false,
        description: "Listen to a unix socket.",
        path: "ipc",
      },
      {
        type: "enum",
        values: [true],
        multiple: false,
        description: "Listen to a unix socket.",
        path: "ipc",
      },
    ],
    description: "Listen to a unix socket.",
    simpleType: "string",
    multiple: false,
  },
  "live-reload": {
    configs: [
      {
        type: "boolean",
        multiple: false,
        description:
          "Enables reload/refresh the page(s) when file changes are detected (enabled by default).",
        negatedDescription:
          "Disables reload/refresh the page(s) when file changes are detected (enabled by default).",
        path: "liveReload",
      },
    ],
    description:
      "Enables reload/refresh the page(s) when file changes are detected (enabled by default).",
    simpleType: "boolean",
    multiple: false,
  },
  "magic-html": {
    configs: [
      {
        type: "boolean",
        multiple: false,
        description:
          "Tells dev-server whether to enable magic HTML routes (routes corresponding to your webpack output, for example '/main' for 'main.js').",
        negatedDescription:
          "Disables magic HTML routes (routes corresponding to your webpack output, for example '/main' for 'main.js').",
        path: "magicHtml",
      },
    ],
    description:
      "Tells dev-server whether to enable magic HTML routes (routes corresponding to your webpack output, for example '/main' for 'main.js').",
    simpleType: "boolean",
    multiple: false,
  },
  open: {
    configs: [
      {
        type: "string",
        multiple: true,
        description:
          "Allows to configure dev server to open the browser(s) and page(s) after server had been started (set it to true to open your default browser).",
        path: "open[]",
      },
      {
        type: "boolean",
        multiple: false,
        description:
          "Allows to configure dev server to open the browser(s) and page(s) after server had been started (set it to true to open your default browser).",
        negatedDescription: "Does not open the default browser.",
        path: "open",
      },
    ],
    description:
      "Allows to configure dev server to open the browser(s) and page(s) after server had been started (set it to true to open your default browser).",
    simpleType: "string",
    multiple: true,
  },
  "open-app": {
    configs: [
      {
        type: "string",
        multiple: true,
        description:
          "Open specified browser. Deprecated: please use '--open-app-name'.",
        path: "open[].app",
      },
    ],
    description:
      "Open specified browser. Deprecated: please use '--open-app-name'.",
    simpleType: "string",
    multiple: true,
  },
  "open-app-name": {
    configs: [
      {
        type: "string",
        multiple: true,
        description: "Open specified browser.",
        path: "open[].app.name",
      },
      {
        type: "string",
        multiple: true,
        description: "Open specified browser.",
        path: "open.app.name[]",
      },
    ],
    description: "Open specified browser.",
    simpleType: "string",
    multiple: true,
  },
  "open-app-name-reset": {
    configs: [
      {
        type: "reset",
        multiple: false,
        description:
          "Clear all items provided in 'open.app.name' configuration. Open specified browser.",
        path: "open.app.name",
      },
    ],
    description:
      "Clear all items provided in 'open.app.name' configuration. Open specified browser.",
    simpleType: "boolean",
    multiple: false,
  },
  "open-reset": {
    configs: [
      {
        type: "reset",
        multiple: false,
        description:
          "Clear all items provided in 'open' configuration. Allows to configure dev server to open the browser(s) and page(s) after server had been started (set it to true to open your default browser).",
        path: "open",
      },
    ],
    description:
      "Clear all items provided in 'open' configuration. Allows to configure dev server to open the browser(s) and page(s) after server had been started (set it to true to open your default browser).",
    simpleType: "boolean",
    multiple: false,
  },
  "open-target": {
    configs: [
      {
        type: "string",
        multiple: true,
        description: "Opens specified page in browser.",
        path: "open[].target",
      },
      {
        type: "string",
        multiple: true,
        description: "Opens specified page in browser.",
        path: "open.target[]",
      },
    ],
    description: "Opens specified page in browser.",
    simpleType: "string",
    multiple: true,
  },
  "open-target-reset": {
    configs: [
      {
        type: "reset",
        multiple: false,
        description:
          "Clear all items provided in 'open.target' configuration. Opens specified page in browser.",
        path: "open.target",
      },
    ],
    description:
      "Clear all items provided in 'open.target' configuration. Opens specified page in browser.",
    simpleType: "boolean",
    multiple: false,
  },
  port: {
    configs: [
      {
        type: "number",
        multiple: false,
        description: "Allows to specify a port to use.",
        path: "port",
      },
      {
        type: "string",
        multiple: false,
        description: "Allows to specify a port to use.",
        path: "port",
      },
      {
        type: "enum",
        values: ["auto"],
        multiple: false,
        description: "Allows to specify a port to use.",
        path: "port",
      },
    ],
    description: "Allows to specify a port to use.",
    simpleType: "string",
    multiple: false,
  },
  "server-options-ca": {
    configs: [
      {
        description:
          "Path to an SSL CA certificate or content of an SSL CA certificate.",
        multiple: true,
        path: "server.options.ca[]",
        type: "string",
      },
    ],
    description:
      "Path to an SSL CA certificate or content of an SSL CA certificate.",
    multiple: true,
    simpleType: "string",
  },
  "server-options-ca-reset": {
    configs: [
      {
        description:
          "Clear all items provided in 'server.options.ca' configuration. Path to an SSL CA certificate or content of an SSL CA certificate.",
        multiple: false,
        path: "server.options.ca",
        type: "reset",
      },
    ],
    description:
      "Clear all items provided in 'server.options.ca' configuration. Path to an SSL CA certificate or content of an SSL CA certificate.",
    multiple: false,
    simpleType: "boolean",
  },
  "server-options-cacert": {
    configs: [
      {
        description:
          "Path to an SSL CA certificate or content of an SSL CA certificate. Deprecated, use the `server.options.ca` option.",
        multiple: true,
        path: "server.options.cacert[]",
        type: "string",
      },
    ],
    description:
      "Path to an SSL CA certificate or content of an SSL CA certificate. Deprecated, use the `server.options.ca` option.",
    multiple: true,
    simpleType: "string",
  },
  "server-options-cacert-reset": {
    configs: [
      {
        description:
          "Clear all items provided in 'server.options.cacert' configuration. Path to an SSL CA certificate or content of an SSL CA certificate. Deprecated, use the `server.options.ca` option.",
        multiple: false,
        path: "server.options.cacert",
        type: "reset",
      },
    ],
    description:
      "Clear all items provided in 'server.options.cacert' configuration. Path to an SSL CA certificate or content of an SSL CA certificate. Deprecated, use the `server.options.ca` option.",
    multiple: false,
    simpleType: "boolean",
  },
  "server-options-cert": {
    configs: [
      {
        description:
          "Path to an SSL certificate or content of an SSL certificate.",
        multiple: true,
        path: "server.options.cert[]",
        type: "string",
      },
    ],
    description: "Path to an SSL certificate or content of an SSL certificate.",
    multiple: true,
    simpleType: "string",
  },
  "server-options-cert-reset": {
    configs: [
      {
        description:
          "Clear all items provided in 'server.options.cert' configuration. Path to an SSL certificate or content of an SSL certificate.",
        multiple: false,
        path: "server.options.cert",
        type: "reset",
      },
    ],
    description:
      "Clear all items provided in 'server.options.cert' configuration. Path to an SSL certificate or content of an SSL certificate.",
    multiple: false,
    simpleType: "boolean",
  },
  "server-options-crl": {
    configs: [
      {
        description:
          "Path to PEM formatted CRLs (Certificate Revocation Lists) or content of PEM formatted CRLs (Certificate Revocation Lists).",
        multiple: true,
        path: "server.options.crl[]",
        type: "string",
      },
    ],
    description:
      "Path to PEM formatted CRLs (Certificate Revocation Lists) or content of PEM formatted CRLs (Certificate Revocation Lists).",
    multiple: true,
    simpleType: "string",
  },
  "server-options-crl-reset": {
    configs: [
      {
        description:
          "Clear all items provided in 'server.options.crl' configuration. Path to PEM formatted CRLs (Certificate Revocation Lists) or content of PEM formatted CRLs (Certificate Revocation Lists).",
        multiple: false,
        path: "server.options.crl",
        type: "reset",
      },
    ],
    description:
      "Clear all items provided in 'server.options.crl' configuration. Path to PEM formatted CRLs (Certificate Revocation Lists) or content of PEM formatted CRLs (Certificate Revocation Lists).",
    multiple: false,
    simpleType: "boolean",
  },
  "server-options-key": {
    configs: [
      {
        description: "Path to an SSL key or content of an SSL key.",
        multiple: true,
        path: "server.options.key[]",
        type: "string",
      },
    ],
    description: "Path to an SSL key or content of an SSL key.",
    multiple: true,
    simpleType: "string",
  },
  "server-options-key-reset": {
    configs: [
      {
        description:
          "Clear all items provided in 'server.options.key' configuration. Path to an SSL key or content of an SSL key.",
        multiple: false,
        path: "server.options.key",
        type: "reset",
      },
    ],
    description:
      "Clear all items provided in 'server.options.key' configuration. Path to an SSL key or content of an SSL key.",
    multiple: false,
    simpleType: "boolean",
  },
  "server-options-passphrase": {
    configs: [
      {
        description: "Passphrase for a pfx file.",
        multiple: false,
        path: "server.options.passphrase",
        type: "string",
      },
    ],
    description: "Passphrase for a pfx file.",
    multiple: false,
    simpleType: "string",
  },
  "server-options-pfx": {
    configs: [
      {
        description: "Path to an SSL pfx file or content of an SSL pfx file.",
        multiple: true,
        path: "server.options.pfx[]",
        type: "string",
      },
    ],
    description: "Path to an SSL pfx file or content of an SSL pfx file.",
    multiple: true,
    simpleType: "string",
  },
  "server-options-pfx-reset": {
    configs: [
      {
        description:
          "Clear all items provided in 'server.options.pfx' configuration. Path to an SSL pfx file or content of an SSL pfx file.",
        multiple: false,
        path: "server.options.pfx",
        type: "reset",
      },
    ],
    description:
      "Clear all items provided in 'server.options.pfx' configuration. Path to an SSL pfx file or content of an SSL pfx file.",
    multiple: false,
    simpleType: "boolean",
  },
  "server-options-request-cert": {
    configs: [
      {
        description: "Request for an SSL certificate.",
        negatedDescription: "Does not request for an SSL certificate.",
        multiple: false,
        path: "server.options.requestCert",
        type: "boolean",
      },
    ],
    description: "Request for an SSL certificate.",
    multiple: false,
    simpleType: "boolean",
  },
  "server-type": {
    configs: [
      {
        description: "Allows to set server and options (by default 'http').",
        multiple: false,
        path: "server.type",
        type: "enum",
        values: ["http", "https", "spdy"],
      },
    ],
    description: "Allows to set server and options (by default 'http').",
    multiple: false,
    simpleType: "string",
  },
  static: {
    configs: [
      {
        type: "string",
        multiple: true,
        description:
          "Allows to configure options for serving static files from directory (by default 'public' directory).",
        path: "static[]",
      },
      {
        type: "boolean",
        multiple: false,
        description:
          "Allows to configure options for serving static files from directory (by default 'public' directory).",
        negatedDescription:
          "Disallows to configure options for serving static files from directory.",
        path: "static",
      },
    ],
    description:
      "Allows to configure options for serving static files from directory (by default 'public' directory).",
    simpleType: "string",
    multiple: true,
  },
  "static-directory": {
    configs: [
      {
        type: "string",
        multiple: true,
        description: "Directory for static contents.",
        path: "static[].directory",
      },
    ],
    description: "Directory for static contents.",
    simpleType: "string",
    multiple: true,
  },
  "static-public-path": {
    configs: [
      {
        type: "string",
        multiple: true,
        description:
          "The static files will be available in the browser under this public path.",
        path: "static[].publicPath",
      },
      {
        type: "string",
        multiple: true,
        description:
          "The static files will be available in the browser under this public path.",
        path: "static.publicPath[]",
      },
    ],
    description:
      "The static files will be available in the browser under this public path.",
    simpleType: "string",
    multiple: true,
  },
  "static-public-path-reset": {
    configs: [
      {
        type: "reset",
        multiple: false,
        description:
          "Clear all items provided in 'static.publicPath' configuration. The static files will be available in the browser under this public path.",
        path: "static.publicPath",
      },
    ],
    description:
      "Clear all items provided in 'static.publicPath' configuration. The static files will be available in the browser under this public path.",
    simpleType: "boolean",
    multiple: false,
  },
  "static-reset": {
    configs: [
      {
        type: "reset",
        multiple: false,
        description:
          "Clear all items provided in 'static' configuration. Allows to configure options for serving static files from directory (by default 'public' directory).",
        path: "static",
      },
    ],
    description:
      "Clear all items provided in 'static' configuration. Allows to configure options for serving static files from directory (by default 'public' directory).",
    simpleType: "boolean",
    multiple: false,
  },
  "static-serve-index": {
    configs: [
      {
        type: "boolean",
        multiple: true,
        description:
          "Tells dev server to use serveIndex middleware when enabled.",
        negatedDescription:
          "Does not tell dev server to use serveIndex middleware.",
        path: "static[].serveIndex",
      },
    ],
    description: "Tells dev server to use serveIndex middleware when enabled.",
    simpleType: "boolean",
    multiple: true,
  },
  "static-watch": {
    configs: [
      {
        type: "boolean",
        multiple: true,
        description: "Watches for files in static content directory.",
        negatedDescription:
          "Does not watch for files in static content directory.",
        path: "static[].watch",
      },
    ],
    description: "Watches for files in static content directory.",
    simpleType: "boolean",
    multiple: true,
  },
  "watch-files": {
    configs: [
      {
        type: "string",
        multiple: true,
        description:
          "Allows to configure list of globs/directories/files to watch for file changes.",
        path: "watchFiles[]",
      },
    ],
    description:
      "Allows to configure list of globs/directories/files to watch for file changes.",
    simpleType: "string",
    multiple: true,
  },
  "watch-files-reset": {
    configs: [
      {
        type: "reset",
        multiple: false,
        description:
          "Clear all items provided in 'watchFiles' configuration. Allows to configure list of globs/directories/files to watch for file changes.",
        path: "watchFiles",
      },
    ],
    description:
      "Clear all items provided in 'watchFiles' configuration. Allows to configure list of globs/directories/files to watch for file changes.",
    simpleType: "boolean",
    multiple: false,
  },
  "web-socket-server": {
    configs: [
      {
        description:
          "Deprecated: please use '--web-socket-server-type' option.",
        negatedDescription: "Disallows to set web socket server and options.",
        multiple: false,
        path: "webSocketServer",
        type: "enum",
        values: [false],
      },
      {
        description:
          "Deprecated: please use '--web-socket-server-type' option.",
        multiple: false,
        path: "webSocketServer",
        type: "enum",
        values: ["sockjs", "ws"],
      },
      {
        description:
          "Allows to set web socket server and options (by default 'ws').",
        multiple: false,
        path: "webSocketServer",
        type: "string",
      },
    ],
    description:
      "Deprecated: please use '--web-socket-server-type' option. Allows to set web socket server and options (by default 'ws').",
    simpleType: "string",
    multiple: false,
  },
  "web-socket-server-type": {
    configs: [
      {
        description:
          "Allows to set web socket server and options (by default 'ws').",
        multiple: false,
        path: "webSocketServer.type",
        type: "enum",
        values: ["sockjs", "ws"],
      },
      {
        description:
          "Allows to set web socket server and options (by default 'ws').",
        multiple: false,
        path: "webSocketServer.type",
        type: "string",
      },
    ],
    description:
      "Allows to set web socket server and options (by default 'ws').",
    simpleType: "string",
    multiple: false,
  },
};

license: mit


code:
"use strict";

const path = require("path");

// Based on https://github.com/webpack/webpack/blob/master/lib/cli.js
// Please do not modify it

/** @typedef {"unknown-argument" | "unexpected-non-array-in-path" | "unexpected-non-object-in-path" | "multiple-values-unexpected" | "invalid-value"} ProblemType */

/**
 * @typedef {Object} Problem
 * @property {ProblemType} type
 * @property {string} path
 * @property {string} argument
 * @property {any=} value
 * @property {number=} index
 * @property {string=} expected
 */

/**
 * @typedef {Object} LocalProblem
 * @property {ProblemType} type
 * @property {string} path
 * @property {string=} expected
 */

/**
 * @typedef {Object} ArgumentConfig
 * @property {string} description
 * @property {string} path
 * @property {boolean} multiple
 * @property {"enum"|"string"|"path"|"number"|"boolean"|"RegExp"|"reset"} type
 * @property {any[]=} values
 */

/**
 * @typedef {Object} Argument
 * @property {string} description
 * @property {"string"|"number"|"boolean"} simpleType
 * @property {boolean} multiple
 * @property {ArgumentConfig[]} configs
 */

const cliAddedItems = new WeakMap();

/**
 * @param {any} config configuration
 * @param {string} schemaPath path in the config
 * @param {number | undefined} index index of value when multiple values are provided, otherwise undefined
 * @returns {{ problem?: LocalProblem, object?: any, property?: string | number, value?: any }} problem or object with property and value
 */
const getObjectAndProperty = (config, schemaPath, index = 0) => {
  if (!schemaPath) {
    return { value: config };
  }

  const parts = schemaPath.split(".");
  const property = parts.pop();
  let current = config;
  let i = 0;

  for (const part of parts) {
    const isArray = part.endsWith("[]");
    const name = isArray ? part.slice(0, -2) : part;
    let value = current[name];

    if (isArray) {
      // eslint-disable-next-line no-undefined
      if (value === undefined) {
        value = {};
        current[name] = [...Array.from({ length: index }), value];
        cliAddedItems.set(current[name], index + 1);
      } else if (!Array.isArray(value)) {
        return {
          problem: {
            type: "unexpected-non-array-in-path",
            path: parts.slice(0, i).join("."),
          },
        };
      } else {
        let addedItems = cliAddedItems.get(value) || 0;

        while (addedItems <= index) {
          // eslint-disable-next-line no-undefined
          value.push(undefined);
          // eslint-disable-next-line no-plusplus
          addedItems++;
        }

        cliAddedItems.set(value, addedItems);

        const x = value.length - addedItems + index;

        // eslint-disable-next-line no-undefined
        if (value[x] === undefined) {
          value[x] = {};
        } else if (value[x] === null || typeof value[x] !== "object") {
          return {
            problem: {
              type: "unexpected-non-object-in-path",
              path: parts.slice(0, i).join("."),
            },
          };
        }

        value = value[x];
      }
      // eslint-disable-next-line no-undefined
    } else if (value === undefined) {
      // eslint-disable-next-line no-multi-assign
      value = current[name] = {};
    } else if (value === null || typeof value !== "object") {
      return {
        problem: {
          type: "unexpected-non-object-in-path",
          path: parts.slice(0, i).join("."),
        },
      };
    }

    current = value;
    // eslint-disable-next-line no-plusplus
    i++;
  }

  const value = current[/** @type {string} */ (property)];

  if (/** @type {string} */ (property).endsWith("[]")) {
    const name = /** @type {string} */ (property).slice(0, -2);
    // eslint-disable-next-line no-shadow
    const value = current[name];

    // eslint-disable-next-line no-undefined
    if (value === undefined) {
      // eslint-disable-next-line no-undefined
      current[name] = [...Array.from({ length: index }), undefined];
      cliAddedItems.set(current[name], index + 1);

      // eslint-disable-next-line no-undefined
      return { object: current[name], property: index, value: undefined };
    } else if (!Array.isArray(value)) {
      // eslint-disable-next-line no-undefined
      current[name] = [value, ...Array.from({ length: index }), undefined];
      cliAddedItems.set(current[name], index + 1);

      // eslint-disable-next-line no-undefined
      return { object: current[name], property: index + 1, value: undefined };
    }

    let addedItems = cliAddedItems.get(value) || 0;

    while (addedItems <= index) {
      // eslint-disable-next-line no-undefined
      value.push(undefined);
      // eslint-disable-next-line no-plusplus
      addedItems++;
    }

    cliAddedItems.set(value, addedItems);

    const x = value.length - addedItems + index;

    // eslint-disable-next-line no-undefined
    if (value[x] === undefined) {
      value[x] = {};
    } else if (value[x] === null || typeof value[x] !== "object") {
      return {
        problem: {
          type: "unexpected-non-object-in-path",
          path: schemaPath,
        },
      };
    }

    return {
      object: value,
      property: x,
      value: value[x],
    };
  }

  return { object: current, property, value };
};

/**
 * @param {ArgumentConfig} argConfig processing instructions
 * @param {any} value the value
 * @returns {any | undefined} parsed value
 */
const parseValueForArgumentConfig = (argConfig, value) => {
  // eslint-disable-next-line default-case
  switch (argConfig.type) {
    case "string":
      if (typeof value === "string") {
        return value;
      }
      break;
    case "path":
      if (typeof value === "string") {
        return path.resolve(value);
      }
      break;
    case "number":
      if (typeof value === "number") {
        return value;
      }

      if (typeof value === "string" && /^[+-]?\d*(\.\d*)[eE]\d+$/) {
        const n = +value;
        if (!isNaN(n)) return n;
      }

      break;
    case "boolean":
      if (typeof value === "boolean") {
        return value;
      }

      if (value === "true") {
        return true;
      }

      if (value === "false") {
        return false;
      }

      break;
    case "RegExp":
      if (value instanceof RegExp) {
        return value;
      }

      if (typeof value === "string") {
        // cspell:word yugi
        const match = /^\/(.*)\/([yugi]*)$/.exec(value);

        if (match && !/[^\\]\//.test(match[1])) {
          return new RegExp(match[1], match[2]);
        }
      }

      break;
    case "enum":
      if (/** @type {any[]} */ (argConfig.values).includes(value)) {
        return value;
      }

      for (const item of /** @type {any[]} */ (argConfig.values)) {
        if (`${item}` === value) return item;
      }

      break;
    case "reset":
      if (value === true) {
        return [];
      }

      break;
  }
};

/**
 * @param {ArgumentConfig} argConfig processing instructions
 * @returns {string | undefined} expected message
 */
const getExpectedValue = (argConfig) => {
  switch (argConfig.type) {
    default:
      return argConfig.type;
    case "boolean":
      return "true | false";
    case "RegExp":
      return "regular expression (example: /ab?c*/)";
    case "enum":
      return /** @type {any[]} */ (argConfig.values)
        .map((v) => `${v}`)
        .join(" | ");
    case "reset":
      return "true (will reset the previous value to an empty array)";
  }
};

/**
 * @param {any} config configuration
 * @param {string} schemaPath path in the config
 * @param {any} value parsed value
 * @param {number | undefined} index index of value when multiple values are provided, otherwise undefined
 * @returns {LocalProblem | null} problem or null for success
 */
const setValue = (config, schemaPath, value, index) => {
  const { problem, object, property } = getObjectAndProperty(
    config,
    schemaPath,
    index
  );

  if (problem) {
    return problem;
  }

  object[/** @type {string} */ (property)] = value;

  return null;
};

/**
 * @param {ArgumentConfig} argConfig processing instructions
 * @param {any} config configuration
 * @param {any} value the value
 * @param {number | undefined} index the index if multiple values provided
 * @returns {LocalProblem | null} a problem if any
 */
const processArgumentConfig = (argConfig, config, value, index) => {
  // eslint-disable-next-line no-undefined
  if (index !== undefined && !argConfig.multiple) {
    return {
      type: "multiple-values-unexpected",
      path: argConfig.path,
    };
  }

  const parsed = parseValueForArgumentConfig(argConfig, value);

  // eslint-disable-next-line no-undefined
  if (parsed === undefined) {
    return {
      type: "invalid-value",
      path: argConfig.path,
      expected: getExpectedValue(argConfig),
    };
  }

  const problem = setValue(config, argConfig.path, parsed, index);

  if (problem) {
    return problem;
  }

  return null;
};

/**
 * @param {Record<string, Argument>} args object of arguments
 * @param {any} config configuration
 * @param {Record<string, string | number | boolean | RegExp | (string | number | boolean | RegExp)[]>} values object with values
 * @returns {Problem[] | null} problems or null for success
 */
const processArguments = (args, config, values) => {
  /**
   * @type {Problem[]}
   */
  const problems = [];

  for (const key of Object.keys(values)) {
    const arg = args[key];

    if (!arg) {
      problems.push({
        type: "unknown-argument",
        path: "",
        argument: key,
      });

      // eslint-disable-next-line no-continue
      continue;
    }

    /**
     * @param {any} value
     * @param {number | undefined} i
     */
    const processValue = (value, i) => {
      const currentProblems = [];

      for (const argConfig of arg.configs) {
        const problem = processArgumentConfig(argConfig, config, value, i);

        if (!problem) {
          return;
        }

        currentProblems.push({
          ...problem,
          argument: key,
          value,
          index: i,
        });
      }

      problems.push(...currentProblems);
    };

    const value = values[key];

    if (Array.isArray(value)) {
      for (let i = 0; i < value.length; i++) {
        processValue(value[i], i);
      }
    } else {
      // eslint-disable-next-line no-undefined
      processValue(value, undefined);
    }
  }

  if (problems.length === 0) {
    return null;
  }

  return problems;
};

module.exports = processArguments;


code:
#!/usr/bin/env node
/* Based on webpack/bin/webpack.js */
/* eslint-disable no-console */

"use strict";

/**
 * @param {string} command process to run
 * @param {string[]} args command line arguments
 * @returns {Promise<void>} promise
 */
const runCommand = (command, args) => {
  const cp = require("child_process");
  return new Promise((resolve, reject) => {
    const executedCommand = cp.spawn(command, args, {
      stdio: "inherit",
      shell: true,
    });

    executedCommand.on("error", (error) => {
      reject(error);
    });

    executedCommand.on("exit", (code) => {
      if (code === 0) {
        resolve();
      } else {
        reject();
      }
    });
  });
};

/**
 * @param {string} packageName name of the package
 * @returns {boolean} is the package installed?
 */
const isInstalled = (packageName) => {
  if (process.versions.pnp) {
    return true;
  }

  const path = require("path");
  const fs = require("graceful-fs");

  let dir = __dirname;

  do {
    try {
      if (
        fs.statSync(path.join(dir, "node_modules", packageName)).isDirectory()
      ) {
        return true;
      }
    } catch (_error) {
      // Nothing
    }
    // eslint-disable-next-line no-cond-assign
  } while (dir !== (dir = path.dirname(dir)));

  // https://github.com/nodejs/node/blob/v18.9.1/lib/internal/modules/cjs/loader.js#L1274
  // @ts-ignore
  for (const internalPath of require("module").globalPaths) {
    try {
      if (fs.statSync(path.join(internalPath, packageName)).isDirectory()) {
        return true;
      }
    } catch (_error) {
      // Nothing
    }
  }

  return false;
};

/**
 * @param {CliOption} cli options
 * @returns {void}
 */
const runCli = (cli) => {
  if (cli.preprocess) {
    cli.preprocess();
  }
  const path = require("path");
  const pkgPath = require.resolve(`${cli.package}/package.json`);
  // eslint-disable-next-line import/no-dynamic-require
  const pkg = require(pkgPath);

  if (pkg.type === "module" || /\.mjs/i.test(pkg.bin[cli.binName])) {
    import(path.resolve(path.dirname(pkgPath), pkg.bin[cli.binName])).catch(
      (error) => {
        console.error(error);
        process.exitCode = 1;
      }
    );
  } else {
    // eslint-disable-next-line import/no-dynamic-require
    require(path.resolve(path.dirname(pkgPath), pkg.bin[cli.binName]));
  }
};

/**
 * @typedef {Object} CliOption
 * @property {string} name display name
 * @property {string} package npm package name
 * @property {string} binName name of the executable file
 * @property {boolean} installed currently installed?
 * @property {string} url homepage
 * @property {function} preprocess preprocessor
 */

/** @type {CliOption} */
const cli = {
  name: "webpack-cli",
  package: "webpack-cli",
  binName: "webpack-cli",
  installed: isInstalled("webpack-cli"),
  url: "https://github.com/webpack/webpack-cli",
  preprocess() {
    process.argv.splice(2, 0, "serve");
  },
};

if (!cli.installed) {
  const path = require("path");
  const fs = require("graceful-fs");
  const readLine = require("readline");

  const notify = `CLI for webpack must be installed.\n  ${cli.name} (${cli.url})\n`;

  console.error(notify);

  /**
   * @type {string}
   */
  let packageManager;

  if (fs.existsSync(path.resolve(process.cwd(), "yarn.lock"))) {
    packageManager = "yarn";
  } else if (fs.existsSync(path.resolve(process.cwd(), "pnpm-lock.yaml"))) {
    packageManager = "pnpm";
  } else {
    packageManager = "npm";
  }

  const installOptions = [packageManager === "yarn" ? "add" : "install", "-D"];

  console.error(
    `We will use "${packageManager}" to install the CLI via "${packageManager} ${installOptions.join(
      " "
    )} ${cli.package}".`
  );

  const question = `Do you want to install 'webpack-cli' (yes/no): `;

  const questionInterface = readLine.createInterface({
    input: process.stdin,
    output: process.stderr,
  });

  // In certain scenarios (e.g. when STDIN is not in terminal mode), the callback function will not be
  // executed. Setting the exit code here to ensure the script exits correctly in those cases. The callback
  // function is responsible for clearing the exit code if the user wishes to install webpack-cli.
  process.exitCode = 1;
  questionInterface.question(question, (answer) => {
    questionInterface.close();

    const normalizedAnswer = answer.toLowerCase().startsWith("y");

    if (!normalizedAnswer) {
      console.error(
        "You need to install 'webpack-cli' to use webpack via CLI.\n" +
          "You can also install the CLI manually."
      );

      return;
    }
    process.exitCode = 0;

    console.log(
      `Installing '${
        cli.package
      }' (running '${packageManager} ${installOptions.join(" ")} ${
        cli.package
      }')...`
    );

    runCommand(packageManager, installOptions.concat(cli.package))
      .then(() => {
        runCli(cli);
      })
      .catch((error) => {
        console.error(error);
        process.exitCode = 1;
      });
  });
} else {
  runCli(cli);
}


code:
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
import SockJS from "../modules/sockjs-client/index.js";
import { log } from "../utils/log.js";
var SockJSClient = /*#__PURE__*/function () {
  /**
   * @param {string} url
   */
  function SockJSClient(url) {
    _classCallCheck(this, SockJSClient);
    // SockJS requires `http` and `https` protocols
    this.sock = new SockJS(url.replace(/^ws:/i, "http:").replace(/^wss:/i, "https:"));
    this.sock.onerror =
    /**
     * @param {Error} error
     */
    function (error) {
      log.error(error);
    };
  }

  /**
   * @param {(...args: any[]) => void} f
   */
  _createClass(SockJSClient, [{
    key: "onOpen",
    value: function onOpen(f) {
      this.sock.onopen = f;
    }

    /**
     * @param {(...args: any[]) => void} f
     */
  }, {
    key: "onClose",
    value: function onClose(f) {
      this.sock.onclose = f;
    }

    // call f with the message string as the first argument
    /**
     * @param {(...args: any[]) => void} f
     */
  }, {
    key: "onMessage",
    value: function onMessage(f) {
      this.sock.onmessage =
      /**
       * @param {Error & { data: string }} e
       */
      function (e) {
        f(e.data);
      };
    }
  }]);
  return SockJSClient;
}();
export { SockJSClient as default };


code:
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
import { log } from "../utils/log.js";
var WebSocketClient = /*#__PURE__*/function () {
  /**
   * @param {string} url
   */
  function WebSocketClient(url) {
    _classCallCheck(this, WebSocketClient);
    this.client = new WebSocket(url);
    this.client.onerror = function (error) {
      log.error(error);
    };
  }

  /**
   * @param {(...args: any[]) => void} f
   */
  _createClass(WebSocketClient, [{
    key: "onOpen",
    value: function onOpen(f) {
      this.client.onopen = f;
    }

    /**
     * @param {(...args: any[]) => void} f
     */
  }, {
    key: "onClose",
    value: function onClose(f) {
      this.client.onclose = f;
    }

    // call f with the message string as the first argument
    /**
     * @param {(...args: any[]) => void} f
     */
  }, {
    key: "onMessage",
    value: function onMessage(f) {
      this.client.onmessage = function (e) {
        f(e.data);
      };
    }
  }]);
  return WebSocketClient;
}();
export { WebSocketClient as default };


code:
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
/* global __resourceQuery, __webpack_hash__ */
/// <reference types="webpack/module" />
import webpackHotLog from "webpack/hot/log.js";
import stripAnsi from "./utils/stripAnsi.js";
import parseURL from "./utils/parseURL.js";
import socket from "./socket.js";
import { formatProblem, createOverlay } from "./overlay.js";
import { log, logEnabledFeatures, setLogLevel } from "./utils/log.js";
import sendMessage from "./utils/sendMessage.js";
import reloadApp from "./utils/reloadApp.js";
import createSocketURL from "./utils/createSocketURL.js";

/**
 * @typedef {Object} OverlayOptions
 * @property {boolean | (error: Error) => boolean} [warnings]
 * @property {boolean | (error: Error) => boolean} [errors]
 * @property {boolean | (error: Error) => boolean} [runtimeErrors]
 * @property {string} [trustedTypesPolicyName]
 */

/**
 * @typedef {Object} Options
 * @property {boolean} hot
 * @property {boolean} liveReload
 * @property {boolean} progress
 * @property {boolean | OverlayOptions} overlay
 * @property {string} [logging]
 * @property {number} [reconnect]
 */

/**
 * @typedef {Object} Status
 * @property {boolean} isUnloading
 * @property {string} currentHash
 * @property {string} [previousHash]
 */

/**
 * @param {boolean | { warnings?: boolean | string; errors?: boolean | string; runtimeErrors?: boolean | string; }} overlayOptions
 */
var decodeOverlayOptions = function decodeOverlayOptions(overlayOptions) {
  if (typeof overlayOptions === "object") {
    ["warnings", "errors", "runtimeErrors"].forEach(function (property) {
      if (typeof overlayOptions[property] === "string") {
        var overlayFilterFunctionString = decodeURIComponent(overlayOptions[property]);

        // eslint-disable-next-line no-new-func
        var overlayFilterFunction = new Function("message", "var callback = ".concat(overlayFilterFunctionString, "\n        return callback(message)"));
        overlayOptions[property] = overlayFilterFunction;
      }
    });
  }
};

/**
 * @type {Status}
 */
var status = {
  isUnloading: false,
  // TODO Workaround for webpack v4, `__webpack_hash__` is not replaced without HotModuleReplacement
  // eslint-disable-next-line camelcase
  currentHash: typeof __webpack_hash__ !== "undefined" ? __webpack_hash__ : ""
};

/** @type {Options} */
var options = {
  hot: false,
  liveReload: false,
  progress: false,
  overlay: false
};
var parsedResourceQuery = parseURL(__resourceQuery);
var enabledFeatures = {
  "Hot Module Replacement": false,
  "Live Reloading": false,
  Progress: false,
  Overlay: false
};
if (parsedResourceQuery.hot === "true") {
  options.hot = true;
  enabledFeatures["Hot Module Replacement"] = true;
}
if (parsedResourceQuery["live-reload"] === "true") {
  options.liveReload = true;
  enabledFeatures["Live Reloading"] = true;
}
if (parsedResourceQuery.progress === "true") {
  options.progress = true;
  enabledFeatures.Progress = true;
}
if (parsedResourceQuery.overlay) {
  try {
    options.overlay = JSON.parse(parsedResourceQuery.overlay);
  } catch (e) {
    log.error("Error parsing overlay options from resource query:", e);
  }

  // Fill in default "true" params for partially-specified objects.
  if (typeof options.overlay === "object") {
    options.overlay = _objectSpread({
      errors: true,
      warnings: true,
      runtimeErrors: true
    }, options.overlay);
    decodeOverlayOptions(options.overlay);
  }
  enabledFeatures.Overlay = true;
}
if (parsedResourceQuery.logging) {
  options.logging = parsedResourceQuery.logging;
}
if (typeof parsedResourceQuery.reconnect !== "undefined") {
  options.reconnect = Number(parsedResourceQuery.reconnect);
}

/**
 * @param {string} level
 */
function setAllLogLevel(level) {
  // This is needed because the HMR logger operate separately from dev server logger
  webpackHotLog.setLogLevel(level === "verbose" || level === "log" ? "info" : level);
  setLogLevel(level);
}
if (options.logging) {
  setAllLogLevel(options.logging);
}
logEnabledFeatures(enabledFeatures);
self.addEventListener("beforeunload", function () {
  status.isUnloading = true;
});
var overlay = typeof window !== "undefined" ? createOverlay(typeof options.overlay === "object" ? {
  trustedTypesPolicyName: options.overlay.trustedTypesPolicyName,
  catchRuntimeError: options.overlay.runtimeErrors
} : {
  trustedTypesPolicyName: false,
  catchRuntimeError: options.overlay
}) : {
  send: function send() {}
};
var onSocketMessage = {
  hot: function hot() {
    if (parsedResourceQuery.hot === "false") {
      return;
    }
    options.hot = true;
  },
  liveReload: function liveReload() {
    if (parsedResourceQuery["live-reload"] === "false") {
      return;
    }
    options.liveReload = true;
  },
  invalid: function invalid() {
    log.info("App updated. Recompiling...");

    // Fixes #1042. overlay doesn't clear if errors are fixed but warnings remain.
    if (options.overlay) {
      overlay.send({
        type: "DISMISS"
      });
    }
    sendMessage("Invalid");
  },
  /**
   * @param {string} hash
   */
  hash: function hash(_hash) {
    status.previousHash = status.currentHash;
    status.currentHash = _hash;
  },
  logging: setAllLogLevel,
  /**
   * @param {boolean} value
   */
  overlay: function overlay(value) {
    if (typeof document === "undefined") {
      return;
    }
    options.overlay = value;
    decodeOverlayOptions(options.overlay);
  },
  /**
   * @param {number} value
   */
  reconnect: function reconnect(value) {
    if (parsedResourceQuery.reconnect === "false") {
      return;
    }
    options.reconnect = value;
  },
  /**
   * @param {boolean} value
   */
  progress: function progress(value) {
    options.progress = value;
  },
  /**
   * @param {{ pluginName?: string, percent: number, msg: string }} data
   */
  "progress-update": function progressUpdate(data) {
    if (options.progress) {
      log.info("".concat(data.pluginName ? "[".concat(data.pluginName, "] ") : "").concat(data.percent, "% - ").concat(data.msg, "."));
    }
    sendMessage("Progress", data);
  },
  "still-ok": function stillOk() {
    log.info("Nothing changed.");
    if (options.overlay) {
      overlay.send({
        type: "DISMISS"
      });
    }
    sendMessage("StillOk");
  },
  ok: function ok() {
    sendMessage("Ok");
    if (options.overlay) {
      overlay.send({
        type: "DISMISS"
      });
    }
    reloadApp(options, status);
  },
  // TODO: remove in v5 in favor of 'static-changed'
  /**
   * @param {string} file
   */
  "content-changed": function contentChanged(file) {
    log.info("".concat(file ? "\"".concat(file, "\"") : "Content", " from static directory was changed. Reloading..."));
    self.location.reload();
  },
  /**
   * @param {string} file
   */
  "static-changed": function staticChanged(file) {
    log.info("".concat(file ? "\"".concat(file, "\"") : "Content", " from static directory was changed. Reloading..."));
    self.location.reload();
  },
  /**
   * @param {Error[]} warnings
   * @param {any} params
   */
  warnings: function warnings(_warnings, params) {
    log.warn("Warnings while compiling.");
    var printableWarnings = _warnings.map(function (error) {
      var _formatProblem = formatProblem("warning", error),
        header = _formatProblem.header,
        body = _formatProblem.body;
      return "".concat(header, "\n").concat(stripAnsi(body));
    });
    sendMessage("Warnings", printableWarnings);
    for (var i = 0; i < printableWarnings.length; i++) {
      log.warn(printableWarnings[i]);
    }
    var overlayWarningsSetting = typeof options.overlay === "boolean" ? options.overlay : options.overlay && options.overlay.warnings;
    if (overlayWarningsSetting) {
      var warningsToDisplay = typeof overlayWarningsSetting === "function" ? _warnings.filter(overlayWarningsSetting) : _warnings;
      if (warningsToDisplay.length) {
        overlay.send({
          type: "BUILD_ERROR",
          level: "warning",
          messages: _warnings
        });
      }
    }
    if (params && params.preventReloading) {
      return;
    }
    reloadApp(options, status);
  },
  /**
   * @param {Error[]} errors
   */
  errors: function errors(_errors) {
    log.error("Errors while compiling. Reload prevented.");
    var printableErrors = _errors.map(function (error) {
      var _formatProblem2 = formatProblem("error", error),
        header = _formatProblem2.header,
        body = _formatProblem2.body;
      return "".concat(header, "\n").concat(stripAnsi(body));
    });
    sendMessage("Errors", printableErrors);
    for (var i = 0; i < printableErrors.length; i++) {
      log.error(printableErrors[i]);
    }
    var overlayErrorsSettings = typeof options.overlay === "boolean" ? options.overlay : options.overlay && options.overlay.errors;
    if (overlayErrorsSettings) {
      var errorsToDisplay = typeof overlayErrorsSettings === "function" ? _errors.filter(overlayErrorsSettings) : _errors;
      if (errorsToDisplay.length) {
        overlay.send({
          type: "BUILD_ERROR",
          level: "error",
          messages: _errors
        });
      }
    }
  },
  /**
   * @param {Error} error
   */
  error: function error(_error) {
    log.error(_error);
  },
  close: function close() {
    log.info("Disconnected!");
    if (options.overlay) {
      overlay.send({
        type: "DISMISS"
      });
    }
    sendMessage("Close");
  }
};
var socketURL = createSocketURL(parsedResourceQuery);
socket(socketURL, onSocketMessage, options.reconnect);