WXL
4 天以前 2cc85c64f1c64a2dbaeae276a3e2ca8420de76b7
node_modules/webpack/lib/hmr/lazyCompilationBackend.js
@@ -19,11 +19,13 @@
/** @typedef {() => Server} CreateServerFunction */
/**
 * @param {Omit<LazyCompilationDefaultBackendOptions, "client"> & { client: NonNullable<LazyCompilationDefaultBackendOptions["client"]>}} options additional options for the backend
 * Returns backend.
 * @param {Omit<LazyCompilationDefaultBackendOptions, "client"> & { client: NonNullable<LazyCompilationDefaultBackendOptions["client"]> }} options additional options for the backend
 * @returns {BackendHandler} backend
 */
module.exports = (options) => (compiler, callback) => {
   const logger = compiler.getInfrastructureLogger("LazyCompilationBackend");
   /** @type {Map<string, number>} */
   const activeModules = new Map();
   const prefix = "/lazy-compilation-using-";
@@ -117,6 +119,7 @@
   server.on(
      "listening",
      /**
       * Handles the callback logic for this hook.
       * @param {Error} err error
       * @returns {void}
       */
@@ -152,7 +155,7 @@
               const key = `${encodeURIComponent(
                  originalModule.identifier().replace(/\\/g, "/").replace(/@/g, "_")
               ).replace(/%(2F|3A|24|26|2B|2C|3B|3D)/g, decodeURIComponent)}`;
               const active = activeModules.get(key) > 0;
               const active = /** @type {number} */ (activeModules.get(key)) > 0;
               return {
                  client: `${options.client}?${encodeURIComponent(urlBase + prefix)}`,
                  data: key,