File tree Expand file tree Collapse file tree 1 file changed +21
-15
lines changed
Expand file tree Collapse file tree 1 file changed +21
-15
lines changed 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- function NamedModulesPlugin ( options ) {
6- this . options = options || { } ;
5+ "use strict" ;
6+
7+ class NamedModulesPlugin {
8+ constructor ( options ) {
9+ this . options = options || { } ;
10+ }
11+
12+ apply ( compiler ) {
13+ compiler . plugin ( "compilation" , ( compilation ) => {
14+ compilation . plugin ( "before-module-ids" , ( modules ) => {
15+ modules . forEach ( ( module ) => {
16+ if ( module . id === null && module . libIdent ) {
17+ module . id = module . libIdent ( {
18+ context : this . options . context || compiler . options . context
19+ } ) ;
20+ }
21+ } ) ;
22+ } ) ;
23+ } ) ;
24+ }
725}
26+
827module . exports = NamedModulesPlugin ;
9- NamedModulesPlugin . prototype . apply = function ( compiler ) {
10- compiler . plugin ( "compilation" , function ( compilation ) {
11- compilation . plugin ( "before-module-ids" , function ( modules ) {
12- modules . forEach ( function ( module ) {
13- if ( module . id === null && module . libIdent ) {
14- module . id = module . libIdent ( {
15- context : this . options . context || compiler . options . context
16- } ) ;
17- }
18- } , this ) ;
19- } . bind ( this ) ) ;
20- } . bind ( this ) ) ;
21- } ;
You can’t perform that action at this time.
0 commit comments