I have a project, I use both Django and Webpack for bundling and process assets. My goal is to make Webpack process all assets, e.g. optimize images. If image is used in js / css file there is no problem. Things are going complicated when I use img only in Django template.
Is there a way to 'inform' Webpack, that particular img is used, and update path for it in Django template after webpack process it?
Edit:
Maybe I need to clarify how build flow works. I have project with multiple 'static' sites. I use Webpack to bundle assets for specific one (due too entrypoints). All assets goes to my dist folder from I can easy collect them using properly configured {% static %}
template tag. But those I implicit import in Django template file must be a name from entrypoint in case of js/css which is ok with me, cuz it is just couple of them per site (of course would be nice if those names could be hashed and Django would know about that) the thing I need most is to process images, for now I just use mentioned CopyWebpackPlugin to copy them all to dist folder from my src.. which is not elegant at all. Why? Because if I use same e.g. image.png in css and html I end up with [hash].png and copied image.png.
I wonder is there a way to e.g. hash names of images on webpack side and somehow inform Django about that image.png is now [hash].png