Skip to content

Commit 994bc7a

Browse files
ryanbraganzaTheLarkInn
authored andcommitted
refactor(es6): Upgrade ExternalsPlugin to es6 (webpack#3621)
1 parent 938072f commit 994bc7a

1 file changed

Lines changed: 13 additions & 8 deletions

File tree

lib/ExternalsPlugin.js

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,20 @@
22
MIT License http://www.opensource.org/licenses/mit-license.php
33
Author Tobias Koppers @sokra
44
*/
5+
"use strict";
6+
57
var ExternalModuleFactoryPlugin = require("./ExternalModuleFactoryPlugin");
68

7-
function ExternalsPlugin(type, externals) {
8-
this.type = type;
9-
this.externals = externals;
9+
class ExternalsPlugin {
10+
constructor(type, externals) {
11+
this.type = type;
12+
this.externals = externals;
13+
}
14+
apply(compiler) {
15+
compiler.plugin("compile", (params) => {
16+
params.normalModuleFactory.apply(new ExternalModuleFactoryPlugin(this.type, this.externals));
17+
});
18+
}
1019
}
20+
1121
module.exports = ExternalsPlugin;
12-
ExternalsPlugin.prototype.apply = function(compiler) {
13-
compiler.plugin("compile", function(params) {
14-
params.normalModuleFactory.apply(new ExternalModuleFactoryPlugin(this.type, this.externals));
15-
}.bind(this));
16-
};

0 commit comments

Comments
 (0)