1 |
3a515b92
|
cagy
|
/*
|
2 |
|
|
MIT License http://www.opensource.org/licenses/mit-license.php
|
3 |
|
|
Author Tobias Koppers @sokra
|
4 |
|
|
*/
|
5 |
|
|
"use strict";
|
6 |
|
|
|
7 |
|
|
const ExternalModuleFactoryPlugin = require("./ExternalModuleFactoryPlugin");
|
8 |
|
|
|
9 |
|
|
class 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 |
|
|
|
23 |
|
|
module.exports = ExternalsPlugin;
|