File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 22 MIT License http://www.opensource.org/licenses/mit-license.php
33 Author Tobias Koppers @sokra
44*/
5- var FunctionModuleTemplatePlugin = require ( "./FunctionModuleTemplatePlugin" ) ;
6- var RequestShortener = require ( "./RequestShortener" ) ;
5+ "use strict" ;
76
8- function FunctionModulePlugin ( options , requestShortener ) {
9- this . options = options ;
10- this . requestShortener = requestShortener ;
7+ const FunctionModuleTemplatePlugin = require ( "./FunctionModuleTemplatePlugin" ) ;
8+ const RequestShortener = require ( "./RequestShortener" ) ;
9+
10+ class FunctionModulePlugin {
11+ constructor ( options , requestShortener ) {
12+ this . options = options ;
13+ this . requestShortener = requestShortener ;
14+ }
15+
16+ apply ( compiler ) {
17+ compiler . plugin ( "compilation" , ( compilation ) => {
18+ compilation . moduleTemplate . requestShortener = this . requestShortener || new RequestShortener ( compiler . context ) ;
19+ compilation . moduleTemplate . apply ( new FunctionModuleTemplatePlugin ( ) ) ;
20+ } ) ;
21+ }
1122}
23+
1224module . exports = FunctionModulePlugin ;
13- FunctionModulePlugin . prototype . apply = function ( compiler ) {
14- compiler . plugin ( "compilation" , function ( compilation ) {
15- compilation . moduleTemplate . requestShortener = this . requestShortener || new RequestShortener ( compiler . context ) ;
16- compilation . moduleTemplate . apply ( new FunctionModuleTemplatePlugin ( ) ) ;
17- } . bind ( this ) ) ;
18- } ;
You can’t perform that action at this time.
0 commit comments