How to use the webpack-hot-middleware/helpers.pathMatch function in webpack-hot-middleware

To help you get started, we’ve selected a few webpack-hot-middleware examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github electrode-io / electrode / packages / electrode-archetype-react-app-dev / lib / dev-admin / middleware.js View on Github external
"use strict";

/* eslint-disable no-console, no-magic-numbers, max-statements */
/* eslint-disable max-params, prefer-template, complexity, global-require */

const Path = require("path");
const Fs = require("fs");
const webpack = require("webpack");
const hotHelpers = require("webpack-hot-middleware/helpers");
const Url = require("url");
const { getWebpackStartConfig } = require("../../config/webpack/util/custom-check");
const { getLogs, getLogEventAsHtml } = require("./log-reader");

hotHelpers.pathMatch = (url, path) => {
  try {
    return Url.parse(url).pathname === Url.parse(path).pathname;
  } catch (e) {
    return false;
  }
};

const webpackDevMiddleware = require("webpack-dev-middleware");
const webpackHotMiddleware = require("webpack-hot-middleware");
const serveIndex = require("serve-index-fs");
const ck = require("chalker");
const archetype = require("electrode-archetype-react-app/config/archetype");
const _ = require("lodash");
const statsUtils = require("../stats-utils");
const statsMapper = require("../stats-mapper");
const devRequire = archetype.devRequire;