Use webpack to manage hashed images


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:

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