source: trip-planner-front/node_modules/webpack/lib/DllEntryPlugin.js@ 1ad8e64

Last change on this file since 1ad8e64 was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago

initial commit

  • Property mode set to 100644
File size: 1.2 KB
Line 
1/*
2 MIT License http://www.opensource.org/licenses/mit-license.php
3 Author Tobias Koppers @sokra
4*/
5
6"use strict";
7
8const DllModuleFactory = require("./DllModuleFactory");
9const DllEntryDependency = require("./dependencies/DllEntryDependency");
10const EntryDependency = require("./dependencies/EntryDependency");
11
12class DllEntryPlugin {
13 constructor(context, entries, options) {
14 this.context = context;
15 this.entries = entries;
16 this.options = options;
17 }
18
19 apply(compiler) {
20 compiler.hooks.compilation.tap(
21 "DllEntryPlugin",
22 (compilation, { normalModuleFactory }) => {
23 const dllModuleFactory = new DllModuleFactory();
24 compilation.dependencyFactories.set(
25 DllEntryDependency,
26 dllModuleFactory
27 );
28 compilation.dependencyFactories.set(
29 EntryDependency,
30 normalModuleFactory
31 );
32 }
33 );
34 compiler.hooks.make.tapAsync("DllEntryPlugin", (compilation, callback) => {
35 compilation.addEntry(
36 this.context,
37 new DllEntryDependency(
38 this.entries.map((e, idx) => {
39 const dep = new EntryDependency(e);
40 dep.loc = {
41 name: this.options.name,
42 index: idx
43 };
44 return dep;
45 }),
46 this.options.name
47 ),
48 this.options,
49 callback
50 );
51 });
52 }
53}
54
55module.exports = DllEntryPlugin;
Note: See TracBrowser for help on using the repository browser.