Use webpack to manage hashed images

Hi,

I’d like all my images to have a hash appended to the filename. The idea is to help me manage assets cache.

From what I understood, with webpack it’s meant to be automatic. However, I always have the normal copy of my images (ie without a hash) in the dist folder. And if I inspect my app, it’s the standard filename that is used. Here is my full webpack config: https://gitlab.com/Jenselme/aurss/blob/7336739dea04cd600a525225e96ccb86667500b1/webpack.config.js

I searched but couldn’t find where this may come from. I tried to use:

...when(production || server, new CopyWebpackPlugin([
      { from: 'static', to: `${outDir}/[path]/[name].[hash].[ext]`, ignore: ['.*'] }, // ignore dot (hidden) files
    ])),

With this, I have images with hashes in their names but they are not referenced in my sources.

My project was created using the CLI (probably version 1.0.0-beta.9). Any ideas on how to do this?

1 Like