Skip to content

docs: update examples #3505

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 2 commits into from
Jul 2, 2021
Merged
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion examples/cli/compression/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ It is enabled by default.
To run this example, run this command in your console or terminal:

```console
npx webpack serve --open-target --compress
npx webpack serve --open-target <url> --compress
```

### What should happen
Expand Down
2 changes: 1 addition & 1 deletion examples/cli/default/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ npx webpack serve --open-target
To run your app using an alternative config, use:

```console
npx webpack serve --open-target --config alternative.config.js
npx webpack serve --open-target <url> --config alternative.config.js
```

## What Should Happen
Expand Down
2 changes: 1 addition & 1 deletion examples/cli/history-api-fallback/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ support in `webpack-dev-server`, effectively asking the server to fallback to
`index.html` in the event that a requested resource cannot be found.

```shell
npx webpack serve --open-target --history-api-fallback
npx webpack serve --open-target <url> --history-api-fallback
```

_Note: some URLs don't work by default. For example; if the url contains a dot.
Expand Down
2 changes: 1 addition & 1 deletion examples/cli/hmr/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ application is running, without a full reload of the page.
To run this example, run this command in your console or terminal:

```console
npx webpack serve --open-target --hot
npx webpack serve --open-target <url> --hot
```

## What Should Happen
Expand Down
14 changes: 7 additions & 7 deletions examples/cli/host-and-port/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,39 +8,39 @@ will run. The `host` and `port` options allow for that.
### IPv4

```console
npx webpack serve --open-target --port 5000 --host 0.0.0.0
npx webpack serve --open-target <url> --port 5000 --host 0.0.0.0
```

### IPv6

_This also works with IPv6_

```console
npx webpack serve --open-target --port 5000 --host ::
npx webpack serve --open-target <url> --port 5000 --host ::
```

### local-ip

Specifying `local-ip` as `host` will try to resolve the `host` option as your local `IPv4` address if available, if `IPv4` is not available it will try to resolve your local `IPv6` address.

```console
npx webpack serve --open-target --port 5000 --host local-ip
npx webpack serve --open-target <url> --port 5000 --host local-ip
```

### local-ipv4

Specifying `local-ipv4` as `host` will try to resolve the `host` option as your local `IPv4` address.

```console
npx webpack serve --open-target --port 5000 --host local-ipv4
npx webpack serve --open-target <url> --port 5000 --host local-ipv4
```

### local-ipv6

Specifying `local-ipv6` as `host` will try to resolve the `host` option as your local `IPv6` address.

```console
npx webpack serve --open-target --port 5000 --host local-ipv6
npx webpack serve --open-target <url> --port 5000 --host local-ipv6
```

#### What Should Happen
Expand All @@ -56,7 +56,7 @@ npx webpack serve --open-target --port 5000 --host local-ipv6
Tell the server to connect to a specific port with the following:

```console
npx webpack serve --open-target --port 9000
npx webpack serve --open-target <url> --port 9000
```

#### What Should Happen
Expand All @@ -69,7 +69,7 @@ npx webpack serve --open-target --port 9000
Specifying `auto` as `port` will try to connect the server to the default port `8080` and if not available it will automatically search for another free port.

```console
npx webpack serve --open-target --port auto
npx webpack serve --open-target <url> --port auto
```

#### What Should Happen
Expand Down
4 changes: 2 additions & 2 deletions examples/cli/https/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ You may choose to wish to run `webpack-dev-server` on `https`.
Use HTTPS protocol.

```console
npx webpack serve --open-target --https
npx webpack serve --open-target <url> --https
```

## https options
Expand All @@ -21,7 +21,7 @@ Customize `https` configuration with the following options:
- `--https-passphrase`: Passphrase for a pfx file.

```console
npx webpack serve --open-target --https-key ./ssl/server.key --https-pfx ./ssl/server.pfx --https-cert ./ssl/server.crt --https-cacert ./ssl/ca.pem --https-passphrase webpack-dev-server
npx webpack serve --open-target <url> --https-key ./ssl/server.key --https-pfx ./ssl/server.pfx --https-cert ./ssl/server.crt --https-cacert ./ssl/ca.pem --https-passphrase webpack-dev-server
```

## What Should Happen
Expand Down
2 changes: 1 addition & 1 deletion examples/cli/multi-compiler/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
`webpack-dev-server` should be able to compile multiple webpack configs.

```shell
npx webpack serve --open-target
npx webpack serve --open-target <url>
```

## What Should Happen
Expand Down
2 changes: 1 addition & 1 deletion examples/cli/node-false/README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# CLI: Webpack `node` Option

```shell
npx webpack serve --open-target
npx webpack serve --open-target <url>
```

## What should happen
Expand Down
4 changes: 2 additions & 2 deletions examples/cli/open-target/README.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
# CLI: Open Target Option

Open browser:
Open default generated URL in browser:

```
npx webpack serve --open-target
npx webpack serve --open-target <url>
```

Open specific page in browser:
Expand Down
2 changes: 1 addition & 1 deletion examples/cli/overlay/README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# CLI: --client-overlay option

```shell
npx webpack serve --open-target --client-overlay
npx webpack serve --open-target <url> --client-overlay
```

## What Should Happen
Expand Down
2 changes: 1 addition & 1 deletion examples/cli/progress/README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# CLI: Progress Option

```shell
npx webpack serve --open-target --client-progress
npx webpack serve --open-target default generated URL in different browsers --client-progress
```

## What Should Happen
Expand Down
6 changes: 3 additions & 3 deletions examples/cli/watch-static/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
## Watching a single directory

```console
npx webpack serve --static assets --open-target
npx webpack serve --static assets --open-target <url>
```

### What Should Happen
Expand All @@ -26,13 +26,13 @@ module.exports = {
```

```console
npx webpack serve --open-target
npx webpack serve --open-target <url>
```

or via CLI only:

```console
npx webpack serve --static assets --static css --open-target
npx webpack serve --static assets --static css --open-target <url>
```

### What Should Happen
Expand Down
4 changes: 2 additions & 2 deletions examples/cli/web-server-socket/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,15 @@ To create a custom server implementation.
This mode uses [SockJS-node](https://github.com/sockjs/sockjs-node) as a server.

```console
npx webpack serve --web-socket-server sockjs --open-target
npx webpack serve --web-socket-server sockjs --open-target <url>
```

## ws

This mode uses [ws](https://github.com/websockets/ws) as a server.

```console
npx webpack serve --web-socket-server ws --open-target
npx webpack serve --web-socket-server ws --open-target <url>
```

### What Should Happen
Expand Down
2 changes: 1 addition & 1 deletion examples/cli/web-socket-url-cli/README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# CLI: Web Socket URL

```console
npx webpack serve --open-target --host 0.0.0.0 --client-web-socket-url ws://<insert-host>:8080
npx webpack serve --open-target <url> --host 0.0.0.0 --client-web-socket-url ws://<insert-host>:8080
```

_NOTE: replace `<insert-host>` with your local IP Address._
Expand Down