| | |
| | | |
| | | const PLUGIN_NAME = "AutomaticPrefetchPlugin"; |
| | | |
| | | /** |
| | | * Records modules from one compilation and adds them back as prefetch |
| | | * dependencies in the next compilation. |
| | | */ |
| | | class AutomaticPrefetchPlugin { |
| | | /** |
| | | * Apply the plugin |
| | | * Registers hooks that remember previously built normal modules and enqueue |
| | | * them as `PrefetchDependency` requests during the next make phase. |
| | | * @param {Compiler} compiler the compiler instance |
| | | * @returns {void} |
| | | */ |
| | |
| | | ); |
| | | } |
| | | ); |
| | | /** @type {{context: string | null, request: string}[] | null} */ |
| | | /** @type {{ context: string | null, request: string }[] | null} */ |
| | | let lastModules = null; |
| | | compiler.hooks.afterCompile.tap(PLUGIN_NAME, (compilation) => { |
| | | lastModules = []; |