setupProxy.js not working with TypeScript #9146
-
Hi everyone, While trying to migrate my react app (currently written in JS) to TypeScript, I am having some trouble regarding the const { createProxyMiddleware } = require('http-proxy-middleware');
module.exports = function (app) {
app.use(
['/api'],
createProxyMiddleware({
target: 'http://localhost:5000'
})
);
}; This worked finde when writing my app in JS completely. However, when I try to start my TypeScript based react app, I get this error:
Can anybody tell me how to fix this? I found several issues here, but all of them seem to be closed without a solution 😕 In the documentation it says that you can simply add an entry like this to your package.json file: "proxy": "http://localhost:5000", This also did not work for me. Is this still up to date? Thank you in advance for any kind of help! |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
What version of |
Beta Was this translation helpful? Give feedback.
What version of
http-proxy-middleware
did you install?