Webpack-dev-server -pfx /path/to/file.pfx devServer.pfxPassphrase. The passphrase to a SSL PFX file. PfxPassphrase: 'passphrase' Usage via the CLI. Webpack-dev-server -pfx-passphrase passphrase devServer.port. 指定要监听请求的端口号： port: 8080. Usage via the CLI. Webpack-dev-server -port 8080 devServer.proxy. Webpack-dev-server # webpack-dev-server (WDS) is the officially maintained development server running in-memory, meaning the bundle contents aren't written out to files but stored in memory. The distinction is vital when trying to debug code and styles.
This guide goes through the various methods used to install webpack.
There is some webpack dev server config (it's part of the whole config): config.devServer = contentBase: './' + (options.publicFolder?
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 for more use cases and options. Browser Support. While webpack-dev-server transpiles the client (browser) scripts to an ES5 state. Moreover, you will use the Webpack Dev Server to serve your project in a local environment with a local web server for development purposes. Last but not least, you need the Webpack CLI as well. Let's install all three dependencies as libraries (node packages) by using npm for your project.
Before we begin, make sure you have a fresh version of Node.js installed. The current Long Term Support (LTS) release is an ideal starting point. You may run into a variety of issues with the older versions as they may be missing functionality webpack and/or its related packages require.
The latest webpack release is:
Webpack Dev Server Express
To install the latest release or a specific version, run one of the following commands:
Whether to use
--save-dev or not depends on your use cases. Say you're using webpack only for bundling, then it's suggested that you install it with
--save-dev option since you're not going to include webpack in your production build. Otherwise you can ignore
If you're using webpack v4 or later, you'll also need to install the CLI.
Installing locally is what we recommend for most projects. This makes it easier to upgrade projects individually when breaking changes are introduced. Typically webpack is run via one or more npm scripts which will look for a webpack installation in your local
To run the local installation of webpack you can access its binary version as
node_modules/.bin/webpack. Alternatively, if you are using npm v5.2.0 or greater, you can run
npx webpack to do it.
The following NPM installation will make
webpack available globally:
Note that this is not a recommended practice. Installing globally locks you down to a specific version of webpack and could fail in projects that use a different version.
If you are enthusiastic about using the latest that webpack has to offer, you can install beta versions or even directly from the webpack repository using the following commands:
Take caution when installing these bleeding edge releases! They may still contain bugs and therefore should not be used in production.