diff --git a/types/webpack-dev-server/index.d.ts b/types/webpack-dev-server/index.d.ts index 48abc9a44c..30fd2482e7 100644 --- a/types/webpack-dev-server/index.d.ts +++ b/types/webpack-dev-server/index.d.ts @@ -5,6 +5,7 @@ // Zheyang Song // Alan Agius // Artur Androsovych +// Dave Cardwell // 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); } } diff --git a/types/webpack-dev-server/webpack-dev-server-tests.ts b/types/webpack-dev-server/webpack-dev-server-tests.ts index f570dd134e..755245b035 100644 --- a/types/webpack-dev-server/webpack-dev-server-tests.ts +++ b/types/webpack-dev-server/webpack-dev-server-tests.ts @@ -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);