* Applies the plugin by registering its hooks on the compiler. * @param {Compiler} compiler the compiler instance * @returns {void}
(compiler)
| 35 | * @returns {void} |
| 36 | */ |
| 37 | apply(compiler) { |
| 38 | compiler.hooks.compilation.tap( |
| 39 | PLUGIN_NAME, |
| 40 | (compilation, { normalModuleFactory }) => { |
| 41 | compilation.dependencyFactories.set( |
| 42 | PrefetchDependency, |
| 43 | normalModuleFactory |
| 44 | ); |
| 45 | } |
| 46 | ); |
| 47 | compiler.hooks.make.tapAsync(PLUGIN_NAME, (compilation, callback) => { |
| 48 | compilation.addModuleChain( |
| 49 | this.context || compiler.context, |
| 50 | new PrefetchDependency(this.request), |
| 51 | (err) => { |
| 52 | callback(err); |
| 53 | } |
| 54 | ); |
| 55 | }); |
| 56 | } |
| 57 | } |
| 58 | |
| 59 | module.exports = PrefetchPlugin; |
nothing calls this directly
no test coverage detected