@@ -86,14 +86,12 @@ class CopyPlugin {
8686
8787 pattern . fromOrigin = pattern . from ;
8888 pattern . from = path . normalize ( pattern . from ) ;
89- pattern . compilerContext = compiler . context ;
90- pattern . context = path . normalize (
91- typeof pattern . context !== "undefined"
92- ? ! path . isAbsolute ( pattern . context )
93- ? path . join ( pattern . compilerContext , pattern . context )
94- : pattern . context
95- : pattern . compilerContext
96- ) ;
89+ pattern . context =
90+ typeof pattern . context === "undefined"
91+ ? compiler . context
92+ : path . isAbsolute ( pattern . context )
93+ ? pattern . context
94+ : path . join ( compiler . context , pattern . context ) ;
9795
9896 logger . log (
9997 `starting to process a pattern from '${ pattern . from } ' using '${ pattern . context } ' context`
@@ -313,7 +311,7 @@ class CopyPlugin {
313311 logger . log ( `determined that '${ from } ' should write to '${ filename } '` ) ;
314312
315313 const sourceFilename = normalizePath (
316- path . relative ( pattern . compilerContext , absoluteFilename )
314+ path . relative ( compiler . context , absoluteFilename )
317315 ) ;
318316
319317 return { absoluteFilename, sourceFilename, filename, toType } ;
@@ -326,15 +324,16 @@ class CopyPlugin {
326324 assets = await Promise . all (
327325 files . map ( async ( file ) => {
328326 const { absoluteFilename, sourceFilename, filename, toType } = file ;
327+ const info =
328+ typeof pattern . info === "function"
329+ ? pattern . info ( file ) || { }
330+ : pattern . info || { } ;
329331 const result = {
330332 absoluteFilename,
331333 sourceFilename,
332334 filename,
333335 force : pattern . force ,
334- info :
335- typeof pattern . info === "function"
336- ? pattern . info ( file ) || { }
337- : pattern . info || { } ,
336+ info,
338337 } ;
339338
340339 // If this came from a glob or dir, add it to the file dependencies
0 commit comments