Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Something strange while copying file and renaming it #27

Open
abczdefg opened this issue Apr 15, 2018 · 4 comments
Open

Something strange while copying file and renaming it #27

abczdefg opened this issue Apr 15, 2018 · 4 comments

Comments

@abczdefg
Copy link

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

@gregnb
Copy link
Owner

gregnb commented Apr 22, 2018

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

@gregnb gregnb added the bug label Apr 22, 2018
@SDantas
Copy link

SDantas commented Dec 20, 2018

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.

@iorrah
Copy link

iorrah commented Jul 21, 2020

@abczdefg have you ever managed to address this issue?

@sibiraj-s
Copy link
Collaborator

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants