UNPKG

546 BJavaScriptView Raw
1/*
2 MIT License http://www.opensource.org/licenses/mit-license.php
3 Author Tobias Koppers @sokra
4*/
5"use strict";
6
7const ExternalModuleFactoryPlugin = require("./ExternalModuleFactoryPlugin");
8
9class ExternalsPlugin {
10 constructor(type, externals) {
11 this.type = type;
12 this.externals = externals;
13 }
14 apply(compiler) {
15 compiler.hooks.compile.tap("ExternalsPlugin", ({ normalModuleFactory }) => {
16 new ExternalModuleFactoryPlugin(this.type, this.externals).apply(
17 normalModuleFactory
18 );
19 });
20 }
21}
22
23module.exports = ExternalsPlugin;