filemanager-webpack-plugin icon indicating copy to clipboard operation
filemanager-webpack-plugin copied to clipboard

Something strange while copying file and renaming it

Open abczdefg opened this issue 6 years ago • 4 comments

Hi! I'd like to copy a file and rename it, but I get a folder named as the name of source file. The code in document likes that:

copy: [
     { source: "./dist/bundle.js", destination: "./newfile.js" }
 ]

Then I make it like that:

    new FileManagerPlugin({
      onEnd: {
        copy: [
          {
            source: path.resolve(__dirname, '../../dist/static/css/app.*.css'),
            destination: path.resolve(__dirname, '../../dist/static/css/app.css')
          }
        ]
      }
    })

I get a folder named app.css, and the source file is copied into this folder. Is there anything wrong in my code? Thank you!

1143_1

abczdefg avatar Apr 15 '18 03:04 abczdefg

What you have in your config seems fine. I'll try to take a look into this issue

gregnb avatar Apr 22 '18 16:04 gregnb

I've encountered the same issue but only when the source contains a pattern instead of a path.

If you are not using a hashed file and you remove the .* from the source attribute it works.

SDantas avatar Dec 20 '18 10:12 SDantas

@abczdefg have you ever managed to address this issue?

iorrah avatar Jul 21 '20 15:07 iorrah

It works as expected. You cannot copy glob into a file, thats how it works. In your example app.*.css could match more than one file in the path. If there are more than one files by any chance. It can't be copied/merged into a single file. It is copied as it is to the target directory.

And. Yes. I agree, the interpolated file names generated by webpack can't be copied by giving a filename, since the filenames are generated dynamically.

PR's are welcome.

sibiraj-s avatar Nov 08 '20 06:11 sibiraj-s