{"size": 433, "ext": "js", "max_stars_repo_path": "packages/cli-plugin-fractal/src/middlewares/proxy-webpack.js", "max_stars_repo_name": "SC-MasoudAhmadi/sitecore-cli", "max_stars_repo_stars_event_min_datetime": "2018-02-28T05:04:43.000Z", "max_stars_repo_stars_event_max_datetime": "2020-09-16T07:49:57.000Z", "max_issues_repo_path": "packages/cli-plugin-fractal/src/middlewares/proxy-webpack.js", "max_issues_repo_name": "SC-MasoudAhmadi/sitecore-cli", "max_issues_repo_issues_event_min_datetime": "2018-10-02T11:32:46.000Z", "max_issues_repo_issues_event_max_datetime": "2022-02-26T12:35:58.000Z", "max_forks_repo_path": "packages/cli-plugin-fractal/src/middlewares/proxy-webpack.js", "max_forks_repo_name": "SC-MasoudAhmadi/sitecore-cli", "max_forks_repo_forks_event_min_datetime": "2018-09-11T19:47:08.000Z", "max_forks_repo_forks_event_max_datetime": "2018-10-02T09:19:58.000Z"}
{"max_stars_count": 3, "max_issues_count": 21, "max_forks_count": 2, "avg_line_length": 28.8666666667, "max_line_length": 116, "alphanum_fraction": 0.5242494226}
const proxy = require('http-proxy-middleware');

module.exports = (config, { host, port }) =>
  proxy(
    config.fractal.proxyPatterns
      .concat(['**/sockjs-node/**', '/**.hot-update.json', '/**.hot-update.js', '/**.hot-update.js.map', 'ws://**'])
      .map(s => s.replace(/\\/gi, '/')),
    {
      target: `http://${host || 'localhost'}:${port}`,
      ws: true,
      changeOrigin: true,
      logLevel: 'silent'
    }
  );
