55
66"use strict" ;
77
8- const path = require ( "path" ) ;
98const ConcatSource = require ( "webpack-sources" ) . ConcatSource ;
109const ModuleFilenameHelpers = require ( "./ModuleFilenameHelpers" ) ;
1110
@@ -25,8 +24,7 @@ function wrapComment(str) {
2524const REGEXP_HASH = / \[ h a s h : ? ( \d + ) ? \] / gi,
2625 REGEXP_CHUNKHASH = / \[ c h u n k h a s h : ? ( \d + ) ? \] / gi,
2726 REGEXP_NAME = / \[ n a m e \] / gi,
28- REGEXP_EXT = / \[ e x t \] / gi,
29- REGEXP_PATH = / \[ p a t h \] / gi;
27+ REGEXP_EXT = / \[ e x t \] / gi;
3028
3129// withHashLength, getReplacer from lib/TemplatedPathPlugin.js
3230const withHashLength = ( replacer , handlerFn ) => {
@@ -62,7 +60,7 @@ const interpolate = (banner, file, hash, chunkHash) => {
6260 . replace ( REGEXP_HASH , withHashLength ( getReplacer ( hash ) ) )
6361 . replace ( REGEXP_CHUNKHASH , withHashLength ( getReplacer ( chunkHash ) ) )
6462 . replace ( REGEXP_NAME , name )
65- . replace ( REGEXP_EXT , ext )
63+ . replace ( REGEXP_EXT , ext ) ;
6664}
6765
6866class BannerPlugin {
@@ -88,10 +86,9 @@ class BannerPlugin {
8886 chunk . files
8987 . filter ( ModuleFilenameHelpers . matchObject . bind ( undefined , options ) )
9088 . forEach ( ( file ) => {
91- const chunkHash = chunk . renderedHash || chunk . hash
92- const comment = interpolate ( banner , file , compilation . hash , chunkHash )
93- console . log ( 'comment: ' , comment ) ;
94- return compilation . assets [ file ] = new ConcatSource ( comment , "\n" , compilation . assets [ file ] )
89+ const chunkHash = chunk . renderedHash || chunk . hash ;
90+ const comment = interpolate ( banner , file , compilation . hash , chunkHash ) ;
91+ return compilation . assets [ file ] = new ConcatSource ( comment , "\n" , compilation . assets [ file ] ) ;
9592 } ) ;
9693 } ) ;
9794 callback ( ) ;
0 commit comments