WXL
4 天以前 3bd962a6d7f61239c020e2dbbeb7341e5b842dd1
node_modules/webpack/lib/node/CommonJsChunkLoadingPlugin.js
@@ -13,6 +13,7 @@
/** @typedef {import("../Module").RuntimeRequirements} RuntimeRequirements */
/**
 * Defines the common js chunk loading plugin options type used by this module.
 * @typedef {object} CommonJsChunkLoadingPluginOptions
 * @property {boolean=} asyncChunkLoading enable async chunk loading
 */
@@ -21,31 +22,34 @@
class CommonJsChunkLoadingPlugin {
   /**
    * Creates an instance of CommonJsChunkLoadingPlugin.
    * @param {CommonJsChunkLoadingPluginOptions=} options options
    */
   constructor(options = {}) {
      this._asyncChunkLoading = options.asyncChunkLoading;
      /** @type {CommonJsChunkLoadingPluginOptions} */
      this.options = options;
   }
   /**
    * Apply the plugin
    * Applies the plugin by registering its hooks on the compiler.
    * @param {Compiler} compiler the compiler instance
    * @returns {void}
    */
   apply(compiler) {
      const ChunkLoadingRuntimeModule = this._asyncChunkLoading
      const ChunkLoadingRuntimeModule = this.options.asyncChunkLoading
         ? require("./ReadFileChunkLoadingRuntimeModule")
         : require("./RequireChunkLoadingRuntimeModule");
      const chunkLoadingValue = this._asyncChunkLoading
      const chunkLoadingValue = this.options.asyncChunkLoading
         ? "async-node"
         : "require";
      new StartupChunkDependenciesPlugin({
         chunkLoading: chunkLoadingValue,
         asyncChunkLoading: this._asyncChunkLoading
         asyncChunkLoading: this.options.asyncChunkLoading
      }).apply(compiler);
      compiler.hooks.thisCompilation.tap(PLUGIN_NAME, (compilation) => {
         const globalChunkLoading = compilation.outputOptions.chunkLoading;
         /**
          * Checks whether this common js chunk loading plugin is enabled for chunk.
          * @param {Chunk} chunk chunk
          * @returns {boolean} true, if wasm loading is enabled for the chunk
          */
@@ -57,8 +61,10 @@
                  : globalChunkLoading;
            return chunkLoading === chunkLoadingValue;
         };
         /** @type {WeakSet<Chunk>} */
         const onceForChunkSet = new WeakSet();
         /**
          * Handles the hook callback for this code path.
          * @param {Chunk} chunk chunk
          * @param {RuntimeRequirements} set runtime requirements
          */