Skip to content

docs(configuration): add more commands for CLI usage of devServer #5323

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Aug 21, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
58 changes: 56 additions & 2 deletions src/content/configuration/dev-server.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,12 @@ Usage via the CLI:
npx webpack serve --bonjour
```

To disable:

```bash
npx webpack serve --no-bonjour
```

You can also pass [custom options](https://github.com/watson/bonjour#initializing) to bonjour, for example:

**webpack.config.js**
Expand Down Expand Up @@ -231,6 +237,12 @@ Usage via the CLI:
npx webpack serve --client-overlay
```

To disable:

```bash
npx webpack serve --no-client-overlay
```

If you want to show only errors:

**webpack.config.js**
Expand Down Expand Up @@ -278,6 +290,12 @@ Usage via the CLI:
npx webpack serve --client-progress
```

To disable:

```bash
npx webpack serve --no-client-progress
```

### webSocketTransport

`'ws' | 'sockjs'` `string`
Expand Down Expand Up @@ -421,6 +439,12 @@ Usage via the CLI:
npx webpack serve --compress
```

To disable:

```bash
npx webpack serve --no-compress
```

## devserver.devMiddleware

Provide options to [webpack-dev-middleware](https://github.com/webpack/webpack-dev-middleware) which handles webpack assets.
Expand Down Expand Up @@ -482,7 +506,13 @@ Usage via CLI
npx webpack serve --http2
```

To pass your own certificate via CLI, use the following options
To disable:

```bash
npx webpack serve --no-http2
```

To pass your own certificate via CLI, use the following options:

```bash
npx webpack serve --http2 --https-key ./path/to/server.key --https-cert ./path/to/server.crt --https-cacert ./path/to/ca.pem
Expand Down Expand Up @@ -532,7 +562,13 @@ Usage via the CLI:
npx webpack serve --https
```

To pass your own certificate via the CLI use the following options
To disable:

```bash
npx webpack serve --no-https
```

To pass your own certificate via the CLI use the following options:

```bash
npx webpack serve --https-key ./path/to/server.key --https--cert ./path/to/server.crt --https-cacert ./path/to/ca.pem
Expand Down Expand Up @@ -614,6 +650,12 @@ Usage via the CLI:
npx webpack serve --history-api-fallback
```

To disable:

```bash
npx webpack serve --no-history-api-fallback
```

For more options and information, see the [connect-history-api-fallback](https://github.com/bripkens/connect-history-api-fallback) documentation.

## devServer.host
Expand Down Expand Up @@ -692,6 +734,12 @@ Usage via the CLI:
npx webpack serve --hot
```

To disable:

```bash
npx webpack serve --no-hot
```

To enable Hot Module Replacement without page refresh as a fallback in case of build failures, use `hot: 'only'`:

**webpack.config.js**
Expand Down Expand Up @@ -884,6 +932,12 @@ Usage via the CLI:
npx webpack serve --open
```

To disable:

```bash
npx webpack serve --no-open
```

To open a specified page in browser:

**webpack.config.js**
Expand Down