Skip to content

Commit 4a863d4

Browse files
authored
docs: improve bonjour example (#3834)
1 parent 8cc4e1b commit 4a863d4

File tree

6 files changed

+61
-25
lines changed

6 files changed

+61
-25
lines changed

examples/bonjour/boolean/README.md

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
# Bonjour (ZeroConf)
2+
3+
The Bonjour capability broadcasts server information via ZeroConf when the Server
4+
is started.
5+
6+
## boolean
7+
8+
**webpack.config.js**
9+
10+
```js
11+
module.exports = {
12+
// ...
13+
devServer: {
14+
bonjour: true,
15+
},
16+
};
17+
```
18+
19+
Usage via CLI:
20+
21+
```console
22+
npx webpack serve --bonjour
23+
```
24+
25+
## What Should Happen
26+
27+
A Zeroconf broadcast should occur, containing data with a type of `http` and a
28+
subtype of `webpack`.

examples/bonjour/boolean/app.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
"use strict";
2+
3+
const target = document.querySelector("#target");
4+
5+
target.innerHTML = "Please check your Zeroconf service.";

examples/bonjour/webpack.config.js renamed to examples/bonjour/boolean/webpack.config.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,12 @@
22

33
// our setup function adds behind-the-scenes bits to the config that all of our
44
// examples need
5-
const { setup } = require("../util");
5+
const { setup } = require("../../util");
66

77
module.exports = setup({
88
context: __dirname,
99
entry: "./app.js",
10+
devServer: {
11+
bonjour: true,
12+
},
1013
});

examples/bonjour/README.md renamed to examples/bonjour/object/README.md

Lines changed: 2 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -3,36 +3,14 @@
33
The Bonjour capability broadcasts server information via ZeroConf when the Server
44
is started.
55

6-
**webpack.config.js**
7-
8-
```js
9-
module.exports = {
10-
// ...
11-
devServer: {
12-
bonjour: true,
13-
},
14-
};
15-
```
16-
17-
Usage via CLI:
18-
19-
```console
20-
npx webpack serve --bonjour
21-
```
22-
23-
## What Should Happen
24-
25-
A Zeroconf broadcast should occur, containing data with a type of `http` and a
26-
subtype of `webpack`.
27-
28-
# Bonjour options
6+
## Bonjour options
297

308
Allows options from bonjour for more [configuration](https://github.com/watson/bonjour#initializing):
319

3210
```js
3311
// webpack.config.js
3412
module.exports = {
35-
/* ... */
13+
// ...
3614
devServer: {
3715
bonjour: {
3816
name: "webpack-dev-server",

examples/bonjour/object/app.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
"use strict";
2+
3+
const target = document.querySelector("#target");
4+
5+
target.innerHTML = "Please check your Zeroconf service.";
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
"use strict";
2+
3+
// our setup function adds behind-the-scenes bits to the config that all of our
4+
// examples need
5+
const { setup } = require("../../util");
6+
7+
module.exports = setup({
8+
context: __dirname,
9+
entry: "./app.js",
10+
devServer: {
11+
bonjour: {
12+
name: "webpack-dev-server",
13+
type: "https",
14+
subtype: "webpack",
15+
},
16+
},
17+
});

0 commit comments

Comments
 (0)