From bbff7403fbf46f9ad92240ac213df8d30ef31b64 Mon Sep 17 00:00:00 2001 From: Florian Dold Date: Thu, 20 Sep 2018 02:56:13 +0200 Subject: update packages --- node_modules/webpack/lib/PrefetchPlugin.js | 68 ++++++++++++++++-------------- 1 file changed, 37 insertions(+), 31 deletions(-) (limited to 'node_modules/webpack/lib/PrefetchPlugin.js') diff --git a/node_modules/webpack/lib/PrefetchPlugin.js b/node_modules/webpack/lib/PrefetchPlugin.js index 4f45d33f7..cc9d17c0c 100644 --- a/node_modules/webpack/lib/PrefetchPlugin.js +++ b/node_modules/webpack/lib/PrefetchPlugin.js @@ -1,31 +1,37 @@ -/* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra -*/ -"use strict"; -const PrefetchDependency = require("./dependencies/PrefetchDependency"); - -class PrefetchPlugin { - - constructor(context, request) { - if(!request) { - this.request = context; - } else { - this.context = context; - this.request = request; - } - } - - apply(compiler) { - compiler.plugin("compilation", (compilation, params) => { - const normalModuleFactory = params.normalModuleFactory; - - compilation.dependencyFactories.set(PrefetchDependency, normalModuleFactory); - }); - compiler.plugin("make", (compilation, callback) => { - compilation.prefetch(this.context || compiler.context, new PrefetchDependency(this.request), callback); - }); - } - -} -module.exports = PrefetchPlugin; +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra +*/ +"use strict"; +const PrefetchDependency = require("./dependencies/PrefetchDependency"); + +class PrefetchPlugin { + constructor(context, request) { + if (!request) { + this.request = context; + } else { + this.context = context; + this.request = request; + } + } + + apply(compiler) { + compiler.hooks.compilation.tap( + "PrefetchPlugin", + (compilation, { normalModuleFactory }) => { + compilation.dependencyFactories.set( + PrefetchDependency, + normalModuleFactory + ); + } + ); + compiler.hooks.make.tapAsync("PrefetchPlugin", (compilation, callback) => { + compilation.prefetch( + this.context || compiler.context, + new PrefetchDependency(this.request), + callback + ); + }); + } +} +module.exports = PrefetchPlugin; -- cgit v1.2.3