Skip to content

Commit 400dd44

Browse files
authored
Fix error importing createProxyMiddleware function
When the `createProxyMiddleware` function is imported with curly braces ({}) like this: ` const { createProxyMiddleware } = require('http-proxy-middleware');` it causes following error: `createProxyMiddleware is not a function` The `createProxyMiddleware` function works when imported without curly braces ({}): `const createProxyMiddleware = require('http-proxy-middleware');`
1 parent 5fc8350 commit 400dd44

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

docusaurus/docs/proxying-api-requests-in-development.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ $ yarn add http-proxy-middleware
8585
Next, create `src/setupProxy.js` and place the following contents in it:
8686

8787
```js
88-
const { createProxyMiddleware } = require('http-proxy-middleware');
88+
const createProxyMiddleware = require('http-proxy-middleware');
8989

9090
module.exports = function(app) {
9191
// ...
@@ -95,7 +95,7 @@ module.exports = function(app) {
9595
You can now register proxies as you wish! Here's an example using the above `http-proxy-middleware`:
9696

9797
```js
98-
const { createProxyMiddleware } = require('http-proxy-middleware');
98+
const createProxyMiddleware = require('http-proxy-middleware');
9999

100100
module.exports = function(app) {
101101
app.use(

0 commit comments

Comments
 (0)