Skip to content

Commit d78de29

Browse files
committed
docs: ipc and watchFiles
1 parent e75b597 commit d78de29

File tree

1 file changed

+72
-5
lines changed

1 file changed

+72
-5
lines changed

src/content/configuration/dev-server.md

Lines changed: 72 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -737,7 +737,7 @@ Usage via the CLI:
737737
npx webpack serve --hot
738738
```
739739

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

742742
**webpack.config.js**
743743

@@ -760,6 +760,44 @@ T> Note that [`webpack.HotModuleReplacementPlugin`](/plugins/hot-module-replacem
760760

761761
## devServer.ipc
762762

763+
`true` `string`
764+
765+
The Unix socket to listen to (instead of a [`host`](#devserverhost)).
766+
767+
Setting it to `true` will listen to a socket at `/your-os-temp-dir/webpack-dev-server.sock`:
768+
769+
**webpack.config.js**
770+
771+
```javascript
772+
module.exports = {
773+
//...
774+
devServer: {
775+
ipc: true,
776+
},
777+
};
778+
```
779+
780+
Usage via the CLI:
781+
782+
```bash
783+
npx webpack serve --ipc
784+
```
785+
786+
You can also listen to a different socket with:
787+
788+
**webpack.config.js**
789+
790+
```javascript
791+
const path = require('path');
792+
793+
module.exports = {
794+
//...
795+
devServer: {
796+
ipc: path.join(__dirname, 'my-socket.sock'),
797+
},
798+
};
799+
```
800+
763801
## devServer.liveReload
764802

765803
`boolean = true`
@@ -1112,7 +1150,7 @@ npx webpack serve --no-static
11121150

11131151
`string = path.join(process.cwd(), 'public')`
11141152

1115-
Tell the server where to serve the content from. This is only necessary if you want to serve static files. [static.publicPath](#publicpath) will be used to determine where the bundles should be served from, and takes precedence.
1153+
Tell the server where to serve the content from. This is only necessary if you want to serve static files. [`static.publicPath`](#publicpath) will be used to determine where the bundles should be served from, and takes precedence.
11161154

11171155
**webpack.config.js**
11181156

@@ -1133,7 +1171,7 @@ T> It is recommended to use an absolute path.
11331171

11341172
### staticOptions
11351173

1136-
It is possible to configure advanced options for serving static files from [static.directory](#directory). See the [Express documentation](http://expressjs.com/en/4x/api.html#express.static) for the possible options.
1174+
It is possible to configure advanced options for serving static files from [`static.directory`](#directory). See the [Express documentation](http://expressjs.com/en/4x/api.html#express.static) for the possible options.
11371175

11381176
**webpack.config.js**
11391177

@@ -1236,7 +1274,7 @@ npx webpack serve --no-static-serve-index
12361274

12371275
`boolean` `object`
12381276

1239-
Tell dev-server to watch the files served by the [static.directory]($directory) option. It is disabled by default. When enabled, file changes will trigger a full page reload.
1277+
Tell dev-server to watch the files served by the [`static.directory`]($directory) option. It is disabled by default. When enabled, file changes will trigger a full page reload.
12401278

12411279
**webpack.config.js**
12421280

@@ -1266,7 +1304,7 @@ To disable:
12661304
npx webpack serve --no-static-watch
12671305
```
12681306

1269-
It is possible to configure advanced options for watching static files from [static.directory](#directory). See the [chokidar](https://github.com/paulmillr/chokidar) documentation for the possible options.
1307+
It is possible to configure advanced options for watching static files from [`static.directory`](#directory). See the [`chokidar`](https://github.com/paulmillr/chokidar) documentation for the possible options.
12701308

12711309
```javascript
12721310
const path = require('path');
@@ -1287,6 +1325,35 @@ module.exports = {
12871325

12881326
## devServer.watchFiles
12891327

1328+
`string` `[string]` `object` `[object]`
1329+
1330+
This option allows you to configure list of globs/directories/files to watch for file changes. For example:
1331+
1332+
```javascript
1333+
module.exports = {
1334+
//...
1335+
devServer: {
1336+
watchFiles: ['src/**/*.php', 'public/**/*'],
1337+
},
1338+
};
1339+
```
1340+
1341+
It is possible to configure advanced options for watching files. See the [`chokidar`](https://github.com/paulmillr/chokidar) documentation for the possible options.
1342+
1343+
```javascript
1344+
module.exports = {
1345+
//...
1346+
devServer: {
1347+
watchFiles: {
1348+
paths: ['src/**/*.php', 'public/**/*'],
1349+
options: {
1350+
usePolling: false,
1351+
},
1352+
},
1353+
},
1354+
};
1355+
```
1356+
12901357
## devServer.webSocketServer
12911358

12921359
`string` `path` `function`

0 commit comments

Comments
 (0)