Allow compressed assets to overwrite original assets with same filename
szanata opened this issue ยท 4 comments
Feature Proposal
Until the version 5.x.x was released, it was possible to set filename
option to just [path]
and it would overwrite the original assets with the compressed ones, keeping the same name.
Since the version 5.x.x this is not possible as you get a webpack error: WARNING in Conflict: Multiple assets emit different content to the same filename XXX.X
.
It would be nice to have this ability again! This could be done by using a new config like overwriteAssets: true
; or setting the filename: [path]
and add the deleteOriginalAssets: true
(today if you do that you end up with no assets in the dist dir); or even just allowing internally to automagically replace the assets if the names collide, as it was before.
This was discussed in this issue.
Feature Use Case
This is useful to test website dist locally in conjunction with the HtmlWebpackPlugin, as the plugin injects the references to the original assets, not the .gzip
or .br
versions of them.
Also, when building to distribute thru dumb CDNs like S3, if you files already have the right filename, you can upload them as they are, just adding the proper Content-Enconding
header, without having to rename the file.
Thanks!
Fixed without new options #212, just set deleteOriginalAssets
to true
for your case, we just move logic for deleting above updating ๐
Thanks @evilebottnawi !
@alexander-akait if deleteOriginalAssets
is set to false
then will it overwriteAssets?