Merge pull request #32595 from davecardwell/webpack-dev-server-writeToDisk

[webpack-dev-server] Add writeToDisk configuration
This commit is contained in:
Armando Aguirre
2019-02-06 14:52:15 -08:00
committed by GitHub
2 changed files with 7 additions and 0 deletions
+3
View File
@@ -5,6 +5,7 @@
// Zheyang Song <https://github.com/ZheyangSong>
// Alan Agius <https://github.com/alan-agius4>
// Artur Androsovych <https://github.com/arturovt>
// Dave Cardwell <https://github.com/davecardwell>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.3
@@ -165,6 +166,8 @@ declare namespace WebpackDevServer {
watchContentBase?: boolean;
/** Control options related to watching the files. */
watchOptions?: webpack.WatchOptions;
/** Tells devServer to write generated assets to the disk. */
writeToDisk?: boolean | ((filePath: string) => boolean);
}
}
@@ -72,6 +72,7 @@ const config: WebpackDevServer.Configuration = {
aggregateTimeout: 300,
poll: 1000
},
writeToDisk: true,
// It's a required option.
publicPath: "/assets/",
headers: { "X-Custom-Header": "yes" }
@@ -83,6 +84,9 @@ const c2: WebpackDevServer.Configuration = {
const c3: WebpackDevServer.Configuration = {
stats: "verbose",
};
const c4: WebpackDevServer.Configuration = {
writeToDisk: (filePath: string) => true,
};
// API example
server = new WebpackDevServer(compiler, config);