react-dazzle
Version:
The simple yet flexible dashbording solution for React
17 lines (14 loc) • 504 B
JavaScript
const config = require('./proxy-config');
/* eslint no-param-reassign: "off" */
module.exports = function getWebpackConfig() {
// Webpack needs the paths to end with a wildcard, node doesn't.
// Webpack also needs to be told to strip the path off the proxied
// request.
return Object.keys(config).reduce((acc, path) => {
acc[`${path}*`] = config[path];
acc[`${path}*`].rewrite = (req) => {
req.url = req.url.replace(path, '');
};
return acc;
}, {});
};