/**

  • Returns a map of hooks for a given compilation object.
  • @param {Compilation} compilation - An instance of Compilation.
  • @throws {TypeError} If the 'compilation' argument is not an instance of Compilation.
  • @returns {Object} A map of hooks including 'linkPreload' and 'linkPrefetch'. */ static getCompilationHooks(compilation) { if (!(compilation instanceof Compilation)) { throw new TypeError( 'The 'compilation' argument must be an instance of Compilation' ); } let hooks = compilationHooksMap.get(compilation); if (hooks === undefined) { hooks = { linkPreload: new SyncWaterfallHook(['source', 'chunk']), linkPrefetch: new SyncWaterfallHook(['source', 'chunk']) }; compilationHooksMap.set(compilation, hooks); } return hooks; }
Webpack Compilation Hooks: Get Compilation Hooks for Preload and Prefetch

原文地址: https://www.cveoy.top/t/topic/oLgL 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录