Sha256: 20776c62a185662f5dd72636e7e890033f919651ed568fa1b9fe25039b6facee

Contents?: true

Size: 1.21 KB

Versions: 10

Compression:

Stored size: 1.21 KB

Contents

/*
	MIT License http://www.opensource.org/licenses/mit-license.php
	Author Tobias Koppers @sokra
*/
"use strict";

const RequireIncludeDependency = require("./RequireIncludeDependency");
const RequireIncludeDependencyParserPlugin = require("./RequireIncludeDependencyParserPlugin");

const ParserHelpers = require("../ParserHelpers");

class RequireIncludePlugin {

	apply(compiler) {
		compiler.plugin("compilation", (compilation, params) => {
			const normalModuleFactory = params.normalModuleFactory;

			compilation.dependencyFactories.set(RequireIncludeDependency, normalModuleFactory);
			compilation.dependencyTemplates.set(RequireIncludeDependency, new RequireIncludeDependency.Template());

			params.normalModuleFactory.plugin("parser", (parser, parserOptions) => {

				if(typeof parserOptions.requireInclude !== "undefined" && !parserOptions.requireInclude)
					return;

				parser.apply(new RequireIncludeDependencyParserPlugin());
				parser.plugin("evaluate typeof require.include", ParserHelpers.evaluateToString("function"));
				parser.plugin("typeof require.include", ParserHelpers.toConstantDependency(JSON.stringify("function")));
			});
		});
	}
}
module.exports = RequireIncludePlugin;

Version data entries

10 entries across 6 versions & 3 rubygems

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