WXL
4 天以前 3bd962a6d7f61239c020e2dbbeb7341e5b842dd1
node_modules/webpack/lib/webworker/ImportScriptsChunkLoadingPlugin.js
@@ -15,9 +15,14 @@
const PLUGIN_NAME = "ImportScriptsChunkLoadingPlugin";
/**
 * Enables worker-side chunk loading via `importScripts` and wires in the
 * runtime helpers needed for startup, loading, and hot updates.
 */
class ImportScriptsChunkLoadingPlugin {
   /**
    * Apply the plugin
    * Registers compilation hooks that attach the `importScripts` chunk-loading
    * runtime and its supporting globals to chunks using that backend.
    * @param {Compiler} compiler the compiler instance
    * @returns {void}
    */
@@ -29,6 +34,8 @@
      compiler.hooks.thisCompilation.tap(PLUGIN_NAME, (compilation) => {
         const globalChunkLoading = compilation.outputOptions.chunkLoading;
         /**
          * Determines whether the chunk resolves additional chunks through the
          * worker-side `importScripts` backend.
          * @param {Chunk} chunk chunk
          * @returns {boolean} true, if wasm loading is enabled for the chunk
          */
@@ -40,8 +47,11 @@
                  : globalChunkLoading;
            return chunkLoading === "import-scripts";
         };
         /** @type {WeakSet<Chunk>} */
         const onceForChunkSet = new WeakSet();
         /**
          * Adds the `importScripts` chunk-loading runtime module to a chunk once
          * and records the globals it depends on.
          * @param {Chunk} chunk chunk
          * @param {RuntimeRequirements} set runtime requirements
          */