Sha256: 98830239516f380a4ef7b5978ff827f6036684e702c9f0f36d426b8d334dc84f

Contents?: true

Size: 1020 Bytes

Versions: 8

Compression:

Stored size: 1020 Bytes

Contents

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

const SingleEntryPlugin = require("./SingleEntryPlugin");
const MultiEntryPlugin = require("./MultiEntryPlugin");
const DynamicEntryPlugin = require("./DynamicEntryPlugin");

module.exports = class EntryOptionPlugin {
	apply(compiler) {
		compiler.plugin("entry-option", (context, entry) => {
			function itemToPlugin(item, name) {
				if(Array.isArray(item)) {
					return new MultiEntryPlugin(context, item, name);
				} else {
					return new SingleEntryPlugin(context, item, name);
				}
			}
			if(typeof entry === "string" || Array.isArray(entry)) {
				compiler.apply(itemToPlugin(entry, "main"));
			} else if(typeof entry === "object") {
				Object.keys(entry).forEach(name => compiler.apply(itemToPlugin(entry[name], name)));
			} else if(typeof entry === "function") {
				compiler.apply(new DynamicEntryPlugin(context, entry));
			}
			return true;
		});
	}
};

Version data entries

8 entries across 6 versions & 3 rubygems

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