Skip to content

Commit

Permalink
Fix error importing createProxyMiddleware function
Browse files Browse the repository at this point in the history
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');`
  • Loading branch information
AMS777 authored Mar 31, 2021
1 parent 5fc8350 commit 400dd44
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions docusaurus/docs/proxying-api-requests-in-development.md
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ $ yarn add http-proxy-middleware
Next, create `src/setupProxy.js` and place the following contents in it:

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

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

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

module.exports = function(app) {
app.use(
Expand Down

1 comment on commit 400dd44

@AMS777
Copy link
Author

@AMS777 AMS777 commented on 400dd44 Mar 31, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.