Skip to content

Commit bbdc892

Browse files
authored
Fix proxy option type (#300)
1 parent 10c6bc1 commit bbdc892

File tree

6 files changed

+611
-62
lines changed

6 files changed

+611
-62
lines changed

demo/docusaurus.config.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -53,12 +53,13 @@ const config = {
5353
theme: {
5454
customCss: require.resolve("./src/css/custom.css"),
5555
},
56-
proxy: {
57-
"/proxy": {
56+
proxy: [
57+
{
58+
context: ["/proxy"],
5859
target: "http://localhost:8091",
5960
pathRewrite: { "^/proxy": "" },
6061
},
61-
},
62+
],
6263
}),
6364
],
6465
],

packages/docusaurus-plugin-proxy/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
},
2323
"devDependencies": {
2424
"@docusaurus/types": "^3.7.0",
25-
"@types/webpack-dev-server": "^4.7.2"
25+
"webpack-dev-server": "^5.2.2"
2626
},
2727
"engines": {
2828
"node": ">=14"

packages/docusaurus-plugin-proxy/src/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ export default function pluginOpenAPI(
2020
configureWebpack(): any {
2121
return {
2222
devServer: {
23-
proxy: options,
23+
proxy: options.proxy,
2424
},
2525
};
2626
},

packages/docusaurus-plugin-proxy/src/types.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@
55
* LICENSE file in the root directory of this source tree.
66
* ========================================================================== */
77

8-
import type { Configuration } from "webpack-dev-server";
8+
import type { ProxyConfigArray } from "webpack-dev-server";
99

1010
export interface PluginOptions {
11-
proxy: Configuration["proxy"];
11+
proxy: ProxyConfigArray | undefined;
1212
}

packages/docusaurus-preset-openapi/src/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ export default function preset(
3434
}
3535

3636
if (proxy !== false) {
37-
plugins.push(makePluginConfig("docusaurus-plugin-proxy", proxy));
37+
plugins.push(makePluginConfig("docusaurus-plugin-proxy", { proxy }));
3838
}
3939

4040
return { themes, plugins };

0 commit comments

Comments
 (0)