Handle asset source being a buffer, not a string#3
Handle asset source being a buffer, not a string#3praxxis wants to merge 1 commit intoalmothafar:masterfrom
Conversation
I am still trying to track down _why_ this happens, but when doing a production build `source()` returns a `Buffer` instead of a string. It seems to be fine in development, so my intuition is that it's minification related, but I haven't been able to isolate exactly which option. Changing `mode`, disabling the Uglify plugin - nothing seems to alter how this works in a production build.
|
Thanks for this PR, for webpack 3 I see this is working correctly, so I'm not sure what this should fix, also in most webpack plugins that I saw and that is working with webpack 4, there are no problems that need this change, may you please provide me with any source that I can see the problem and the resolution? or at least a similar issue that fixed in this way on another plugin. |
|
I've tracked this down to imagemin-webpack-plugin. I have an example repo up at https://github.com/praxxis/manifest-plugin-bug that shows the problem. From my debugging it seems that including the imagemin plugin turns source assets into |
|
webpack/webpack-sources#26 looks like a similar bug, and it points to Webpack's implementation being inconsistent |
|
a workaround for anyone else hitting this: change the |
|
I think extra Also, Anyways, I really not have that much experience of webpack plugins development, I will look into your repo and try to figure out what the problem. |
I am still trying to track down why this happens, but when doing a production build
source()returns aBufferinstead of a string. It seems to be fine in development, so my intuition is that it's minification related, but I haven't been able to isolate exactly which option. Changingmode, disabling the Uglify plugin - nothing seems to alter how this works in a production build.Example in production build (output of
typeof compilation.assets[manifestPath].source()):type of source: objectvs dev
type of source: string