Skip to content
This repository has been archived by the owner on Mar 23, 2018. It is now read-only.

Incorrectly cleans up files from file-loader plugin with ./ in name #20

Closed
mobz opened this issue Oct 13, 2016 · 3 comments
Closed

Incorrectly cleans up files from file-loader plugin with ./ in name #20

mobz opened this issue Oct 13, 2016 · 3 comments
Labels

Comments

@mobz
Copy link

mobz commented Oct 13, 2016

If the file-loader is used, and there is a ./ in the name, emitted files will be cleaned up by this plugin

To see this behaviour,
Unzip attached project.

npm install && npm run build

You will see two files are emitted, but the svg is not in the dist directory.
If you remove the WebpackCleanupPlugin it will work as expected.
If you remove the ./ from the name part of the file-loader module it will work as expected

test-webpack-cleanup-plugin.zip

@mobz
Copy link
Author

mobz commented Oct 13, 2016

Playing around with this bit more, if I change WebpackCleanupPlugin.js:22 to

const assets = stats.toJson().assets.map(asset => path.join(asset.name) );

It resolves the issue, however I'm not sure that's the right thing to do

@gpbl gpbl added the bug label Oct 13, 2016
@gpbl
Copy link
Owner

gpbl commented Oct 13, 2016

Thanks @mobz for providing the zip to test this case. Your solution is right, the problem is when excluding files with a relative path in it. I've added the case in this test as it is a situation that getFiles should handle (not the plugin itself).

Going to release a fix soon!

@gpbl
Copy link
Owner

gpbl commented Oct 13, 2016

I've published the fix as v0.4.1. Feel free to write back if not working as expected.

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

No branches or pull requests

2 participants