@types/webpack-dev-server

  • Version 4.3.1
  • Published
  • 18.6 kB
  • 9 dependencies
  • MIT license

Install

npm i @types/webpack-dev-server
yarn add @types/webpack-dev-server
pnpm add @types/webpack-dev-server

Overview

TypeScript definitions for webpack-dev-server

Index

Classes

class WebpackDevServer

class WebpackDevServer {}

    constructor

    constructor(config: WebpackDevServer.Configuration, webpack?: any);

      constructor

      constructor(webpack: any, config?: WebpackDevServer.Configuration);
      • Deprecated

        - use options as the first argument and compiler as the second argument.

      property app

      app: any;

        property server

        server: any;

          property sockets

          sockets: any[];

            method close

            close: (callback?: () => void) => void;
            • Deprecated

              - use stopCallback or stop instead

            method listen

            listen: {
            (port: number, hostname: string, callback?: (error?: Error) => void): any;
            (port: number, callback?: (error?: Error) => void): any;
            };
            • Deprecated

              - use startCallback or start instead

            method sendMessage

            sendMessage: (sockets: NodeJS.EventEmitter[], type: string, data?: any) => void;

              method start

              start: () => Promise<void>;

              method startCallback

              startCallback: (callback: () => void) => void;

                method stop

                stop: () => Promise<void>;

                method stopCallback

                stopCallback: (callback: () => void) => void;

                  Interfaces

                  interface Client

                  interface Client {}

                    property logging

                    logging?: 'log' | 'info' | 'warn' | 'error' | 'none' | 'verbose' | undefined;
                    • Allows to set log level in the browser, e.g. before reloading, before an error or when Hot Module Replacement is enabled.

                    property overlay

                    overlay?:
                    | boolean
                    | {
                    warnings?: boolean | undefined;
                    errors?: boolean | undefined;
                    }
                    | undefined;
                    • Shows a full-screen overlay in the browser when there are compiler errors or warnings. Disabled by default.

                    property progress

                    progress?: boolean | undefined;
                    • Prints compilation progress in percentage in the browser.

                    property webSocketTransport

                    webSocketTransport?: 'ws' | 'sockjs' | string | undefined;
                    • This option allows us either to choose the current web-socket server or to provide custom web-socket server implementation.

                    property webSocketURL

                    webSocketURL?: string | WebSocketURL | undefined;
                    • This option 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).

                    interface Configuration

                    interface Configuration {}

                      property allowedHosts

                      allowedHosts?: 'all' | string | string[] | undefined;
                      • This option allows you to whitelist services that are allowed to access the dev server.

                      property bonjour

                      bonjour?: boolean | bonjour.BonjourOptions | undefined;
                      • This option broadcasts the server via ZeroConf networking on start.

                      property client

                      client?: Client | undefined;

                        property compress

                        compress?: boolean | undefined;
                        • Enable gzip compression for everything served.

                        property devMiddleware

                        devMiddleware?: webpackDevMiddleware.Options;

                          property headers

                          headers?: Header | (() => Header) | undefined;
                          • Adds headers to all responses.

                          property historyApiFallback

                          historyApiFallback?: boolean | connectHistoryApiFallback.Options | undefined;
                          • When using the HTML5 History API, the index.html page will likely have to be served in place of any 404 responses.

                          property host

                          host?: 'local-ip' | 'local-ipv4' | 'local-ipv6' | string | undefined;
                          • Specify a host to use. By default this is localhost.

                          property hot

                          hot?: 'only' | boolean | undefined;
                          • Enable webpack's Hot Module Replacement feature.

                          property http2

                          http2?: boolean | undefined;
                          • Serve over HTTP/2 using spdy. This option is ignored for Node 10.0.0 and above, as spdy is broken for those versions. The dev server will migrate over to Node's built-in HTTP/2 once Express supports it.

                          property https

                          https?: boolean | https.ServerOptions | undefined;
                          • By default dev-server will be served over HTTP. It can optionally be served over HTTP/2 with HTTPS.

                          property ipc

                          ipc?: boolean | string | undefined;

                            property liveReload

                            liveReload?: boolean | undefined;
                            • By default, the dev-server will reload/refresh the page when file changes are detected. devServer.hot option must be disabled or devServer.watchContentBase option must be enabled in order for liveReload to take effect. Disable devServer.liveReload by setting it to false

                            property magicHtml

                            magicHtml?: boolean | undefined;
                            • Tells dev-server whether to enable magic HTML routes (routes corresponding to your webpack output, for example '/main' for 'main.js'). true

                            property onAfterSetupMiddleware

                            onAfterSetupMiddleware?: ((devServer: WebpackDevServer) => void) | undefined;
                            • Provides the ability to execute custom middleware after all other middleware internally within the server.

                            property onBeforeSetupMiddleware

                            onBeforeSetupMiddleware?: ((devServer: WebpackDevServer) => void) | undefined;
                            • Provides the ability to execute custom middleware prior to all other middleware internally within the server.

                            property onListening

                            onListening?: ((devServer: WebpackDevServer) => void) | undefined;
                            • Provides an option to execute a custom function when webpack-dev-server starts listening for connections on a port.

                            property open

                            open?: boolean | string | string[] | Open | Open[] | undefined;
                            • When open is enabled, the dev server will open the browser.

                            property port

                            port?: 'auto' | string | number | undefined;
                            • Specify a port number to listen for requests on.

                            property proxy

                            proxy?: ProxyConfigMap | ProxyConfigArray | undefined;
                            • Proxying some URLs can be useful when you have a separate API backend development server and you want to send API requests on the same domain.

                              The dev-server makes use of the powerful http-proxy-middleware package. Check out its [documentation](https://github.com/chimurai/http-proxy-middleware#options) for more advanced usages. Note that some of http-proxy-middleware's features do not require a target key, e.g. its router feature, but you will still need to include a target key in your config here, otherwise webpack-dev-server won't pass it along to http-proxy-middleware).

                            property setupExitSignals

                            setupExitSignals?: boolean | undefined;
                            • Allows to close dev server and exit the process on SIGINT and SIGTERM signals.

                            property static

                            static?: boolean | string | Static | Array<string | Static> | undefined;
                            • This options allows to configure options for serving static files from directory (by default 'public' directory).

                            property watchFiles

                            watchFiles?:
                            | string
                            | string[]
                            | WatchFiles
                            | Array<WatchFiles | string>
                            | undefined;
                            • This option allows you to configure list of globs/directories/files to watch for file changes.

                            property webSocketServer

                            webSocketServer?:
                            | boolean
                            | 'sockjs'
                            | 'ws'
                            | string
                            | (() => void)
                            | Record<string, any>;
                            • This option allows us either to choose the current web-socket server or to provide custom web-socket server implementation.

                            interface Open

                            interface Open {}

                              property app

                              app?: string | string[] | OpenApp | undefined;
                              • Open specified browser.

                              property target

                              target?: string | string[] | undefined;
                              • Opens specified page in browser.

                              interface OpenApp

                              interface OpenApp {}

                                property arguments

                                arguments?: string[] | undefined;

                                  property name

                                  name?: string | undefined;

                                    interface ProxyConfigMap

                                    interface ProxyConfigMap {}

                                      index signature

                                      [url: string]: string | httpProxyMiddleware.Options;

                                        interface Static

                                        interface Static {}

                                          property directory

                                          directory?: string | undefined;
                                          • Tell the server where to serve content from. This is only necessary if you want to serve static files. devServer.publicPath will be used to determine where the bundles should be served from, and takes precedence.

                                          property publicPath

                                          publicPath?: string | string[] | undefined;
                                          • Tell the server at which URL to serve static.directory content. For example to serve a file assets/manifest.json at /serve-public-path-url/manifest.json, your configurations should be as following:

                                          property serveIndex

                                          serveIndex?: boolean | serveIndex.Options | undefined;
                                          • Tell dev-server to use serveIndex middleware when enabled.

                                            serveIndex middleware generates directory listings on viewing directories that don't have an index.html file.

                                          property staticOptions

                                          staticOptions?: serveStatic.ServeStaticOptions | undefined;
                                          • It is possible to configure advanced options for serving static files from static.directory. See the Express documentation for the possible options.

                                          property watch

                                          watch?: boolean | chokidar.WatchOptions | undefined;
                                          • Tell dev-server to watch the files served by the static.directory option. It is disabled by default. When enabled, file changes will trigger a full page reload.

                                          interface WatchFiles

                                          interface WatchFiles {}

                                            property options

                                            options?: chokidar.WatchOptions | undefined;

                                              property paths

                                              paths?: string[] | string | undefined;

                                                interface WebSocketURL

                                                interface WebSocketURL {}

                                                  property hostname

                                                  hostname?: string | undefined;
                                                  • Tells clients connected to devServer to use the provided hostname.

                                                  property password

                                                  password?: string | undefined;
                                                  • Tells clients connected to devServer to use the provided password to authenticate.

                                                  property pathname

                                                  pathname?: string | undefined;
                                                  • Tells clients connected to devServer to use the provided path to connect.

                                                  property port

                                                  port?: number | string | undefined;
                                                  • Tells clients connected to devServer to use the provided port.

                                                  property protocol

                                                  protocol?: string | undefined;
                                                  • Tells clients connected to devServer to use the provided protocol.

                                                  property username

                                                  username?: string | undefined;
                                                  • Tells clients connected to devServer to use the provided username to authenticate.

                                                  Type Aliases

                                                  type Header =
                                                  | Array<{ key: string; value: string }>
                                                  | Record<string, string | string[]>;

                                                    type ProxyConfigArray

                                                    type ProxyConfigArray = ProxyConfigArrayItem[];

                                                      type ProxyConfigArrayItem

                                                      type ProxyConfigArrayItem = {
                                                      path?: string | string[] | undefined;
                                                      context?: string | string[] | httpProxyMiddleware.Filter | undefined;
                                                      } & httpProxyMiddleware.Options;

                                                        Package Files (1)

                                                        Dependencies (9)

                                                        Dev Dependencies (0)

                                                        No dev dependencies.

                                                        Peer Dependencies (0)

                                                        No peer dependencies.

                                                        Badge

                                                        To add a badge like this onejsDocs.io badgeto your package's README, use the codes available below.

                                                        You may also use Shields.io to create a custom badge linking to https://www.jsdocs.io/package/@types/webpack-dev-server.

                                                        • Markdown
                                                          [![jsDocs.io](https://img.shields.io/badge/jsDocs.io-reference-blue)](https://www.jsdocs.io/package/@types/webpack-dev-server)
                                                        • HTML
                                                          <a href="https://www.jsdocs.io/package/@types/webpack-dev-server"><img src="https://img.shields.io/badge/jsDocs.io-reference-blue" alt="jsDocs.io"></a>