[webpack-dev-server] Add httpProxyMiddleware.Filter support to context property of ProxyConfigArrayItem

webpack-dev-server [proxy documentation](https://webpack.js.org/configuration/dev-server/#devserverproxy) gives an example of using Filter function for context property and in reality dev-server supports it. However, it was missing on `@types/webpack-dev-server`.
This commit is contained in:
minijus
2019-03-04 13:33:56 +02:00
parent 34116971d5
commit bd70136392
2 changed files with 4 additions and 1 deletions
+1 -1
View File
@@ -28,7 +28,7 @@ declare namespace WebpackDevServer {
type ProxyConfigArrayItem = {
path?: string | string[];
context?: string | string[]
context?: string | string[] | httpProxyMiddleware.Filter
} & httpProxyMiddleware.Config;
type ProxyConfigArray = ProxyConfigArrayItem[];
@@ -87,6 +87,9 @@ const c3: WebpackDevServer.Configuration = {
const c4: WebpackDevServer.Configuration = {
writeToDisk: (filePath: string) => true,
};
const c5: WebpackDevServer.Configuration = {
proxy: [{context: (pathname: string) => true}]
};
// API example
server = new WebpackDevServer(compiler, config);