Sha256: ff02d35a976300c9e3547c28adc7ab152a5c145eec3b834189b38bfcd4de6f7b

Contents?: true

Size: 826 Bytes

Versions: 11

Compression:

Stored size: 826 Bytes

Contents

/*
	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;

Version data entries

11 entries across 7 versions & 4 rubygems

Version Path
ilog-0.4.1 node_modules/webpack/lib/PrefetchPlugin.js
ilog-0.4.0 node_modules/webpack/lib/PrefetchPlugin.js
ilog-0.3.3 node_modules/webpack/lib/PrefetchPlugin.js
optimacms-0.4.3 spec/dummy/node_modules/@rails/webpacker/node_modules/webpack/lib/PrefetchPlugin.js
optimacms-0.4.3 spec/dummy/node_modules/@rails/webpacker/node_modules/webpack/node_modules/webpack/lib/PrefetchPlugin.js
optimacms-0.4.3 spec/dummy/node_modules/webpack/lib/PrefetchPlugin.js
optimacms-0.4.2 spec/dummy/node_modules/@rails/webpacker/node_modules/webpack/lib/PrefetchPlugin.js
optimacms-0.4.2 spec/dummy/node_modules/@rails/webpacker/node_modules/webpack/node_modules/webpack/lib/PrefetchPlugin.js
optimacms-0.4.2 spec/dummy/node_modules/webpack/lib/PrefetchPlugin.js
cortex-0.1.3 spec/dummy/node_modules/webpack/lib/PrefetchPlugin.js
lanes-0.8.0 node_modules/webpack/lib/PrefetchPlugin.js