Skip to content

Commit 1901cd3

Browse files
AlexDubokEugeneHlushko
authored andcommitted
docs(devServer): add writeToDisk option (#2747)
1 parent 6018815 commit 1901cd3

File tree

1 file changed

+33
-0
lines changed

1 file changed

+33
-0
lines changed

src/content/configuration/dev-server.md

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1226,3 +1226,36 @@ module.exports = {
12261226
If this is too heavy on the file system, you can change this to an integer to set the interval in milliseconds.
12271227

12281228
See [WatchOptions](/configuration/watch/) for more options.
1229+
1230+
1231+
## `devServer.writeToDisk` 🔑
1232+
1233+
`boolean: false` `function (filePath)`
1234+
1235+
Tells `devServer` to write generated assets to the disk.
1236+
1237+
__webpack.config.js__
1238+
1239+
```javascript
1240+
module.exports = {
1241+
//...
1242+
devServer: {
1243+
writeToDisk: true
1244+
}
1245+
};
1246+
```
1247+
1248+
Providing a `Function` to `devServer.writeToDisk` can be used for filtering. The function follows the same premise as [`Array#filter`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/filter) in which a boolean return value tells if the file should be written to disk.
1249+
1250+
__webpack.config.js__
1251+
1252+
```javascript
1253+
module.exports = {
1254+
//...
1255+
devServer: {
1256+
writeToDisk: (filePath) => {
1257+
return /superman\.css$/.test(filePath);
1258+
}
1259+
}
1260+
};
1261+
```

0 commit comments

Comments
 (0)