Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
const getProxyMiddleware = ({ proxy } = {}) => {
if (!proxy) {
return [];
}
let normalizedConfig = proxy;
if (!R_.isArray(proxy)) {
normalizedConfig = R.pipe(
R.mapObjIndexed((target, context) => {
// for more info see https://github.com/webpack/webpack-dev-server/blob/master/lib/Server.js#L193
const correctedContext = R.o(R.replace(/\/\*$/, ''), R.replace(/^\*$/, '**'))(context);
if (R_.isString(target)) {
return {
context: correctedContext,
target,
};
} else {
return {
...target,
context: correctedContext,
};
}
}),
const proxyMiddleware = ({ proxy } = {}) => {
if (!proxy) {
return [];
}
let normalizedConfig = proxy;
if (!isArray(proxy)) {
normalizedConfig = pipe(
mapObjIndexed((target, context) => {
// for more info see https://github.com/webpack/webpack-dev-server/blob/master/lib/Server.js#L193
const correctedContext = o(replace(/\/\*$/, ''), replace(/^\*$/, '**'))(context);
if (isString(target)) {
return {
context: correctedContext,
target,
};
} else {
return {
...target,
context: correctedContext,
};
}
}),