@@ -126,16 +126,19 @@ class UglifyJsPlugin {
126126 case "boolean" :
127127 var b = condition [ key ] ;
128128 condition [ key ] = ( ) => b ;
129- case "function" : // eslint-disable-line no-fallthrough
129+ break ;
130+ case "function" :
130131 break ;
131132 case "string" :
132133 if ( condition [ key ] === "all" ) {
133134 condition [ key ] = ( ) => true ;
134135 break ;
135136 }
136- condition [ key ] = new RegExp ( condition [ key ] ) ;
137- default : // eslint-disable-line no-fallthrough
138- var regex = condition [ key ] ;
137+ var regex = new RegExp ( condition [ key ] ) ;
138+ condition [ key ] = ( astNode , comment ) => regex . test ( comment . value ) ;
139+ break ;
140+ default :
141+ regex = condition [ key ] ;
139142 condition [ key ] = ( astNode , comment ) => regex . test ( comment . value ) ;
140143 }
141144 } ) ;
@@ -163,11 +166,11 @@ class UglifyJsPlugin {
163166 ast . print ( stream ) ;
164167 if ( map ) map = map + "" ;
165168 const stringifiedStream = stream + "" ;
166- asset . __UglifyJsPlugin = compilation . assets [ file ] = ( map ?
169+ let outputSource = ( map ?
167170 new SourceMapSource ( stringifiedStream , file , JSON . parse ( map ) , input , inputSourceMap ) :
168171 new RawSource ( stringifiedStream ) ) ;
169172 if ( extractedComments . length > 0 ) {
170- let commentsFile = options . extractComments . file || file + ".LICENSE" ;
173+ let commentsFile = options . extractComments . filename || file + ".LICENSE" ;
171174 if ( typeof commentsFile === "function" ) {
172175 commentsFile = commentsFile ( file ) ;
173176 }
@@ -195,12 +198,13 @@ class UglifyJsPlugin {
195198 banner = banner ( commentsFile ) ;
196199 }
197200 if ( banner ) {
198- asset . __UglifyJsPlugin = compilation . assets [ file ] = new ConcatSource (
199- "/*! " + banner + " */\n" , compilation . assets [ file ]
201+ outputSource = new ConcatSource (
202+ "/*! " + banner + " */\n" , outputSource
200203 ) ;
201204 }
202205 }
203206 }
207+ asset . __UglifyJsPlugin = compilation . assets [ file ] = outputSource ;
204208 if ( warnings . length > 0 ) {
205209 compilation . warnings . push ( new Error ( file + " from UglifyJs\n" + warnings . join ( "\n" ) ) ) ;
206210 }
0 commit comments