I have this code using CRA --template typescript in setupProxy.js file
const { createProxyMiddleware } = require('http-proxy-middleware');
module.exports = function (app) {
app.use(
'/user/try',
createProxyMiddleware({
target: 'http://localhost:8002',
changeOrigin: true,
})
);
};
but the problem is that setupProxy.js file is completely ignored causing my request to fail.
I know I can use the "proxy": "http://localhost:8002" in package.json but it will not accept multiple proxies.
To further test, I also created a new CRA but without typescript and suddenly it's working with the same code above.
Is there a way to make setupProxy.js work in CRA typescript?