WEBAPP - Custom webpack.config.js for ionic 5

When building the Ionic APP to be hosted on a website /www folder all works great until we deploy an updated version of the project. Because then the browser cache kicks in and for example a lazy loaded modules like “node_modules_ionic_core_dist_esm_ion-modal_entry_js.js” are loaded from disk cache, instead of the new compiled one. But this file is already outdated, so the application does not work as expected and crashes.

So after some research we found this website: https://www.anagram.at/en/ionic-cache-busting-webpack/ which describes the problem perfectly. Unfortunately it only suggests a fix with the webpack.config.js for v3 of ionic.

So, how can you add a version parameter to the build files in the /www folder, when building for a browser application. It happens on all lazy loaded files in the map of main.js (ionic_core_dist_esm) With ionic serve, or on the device, or in a fresh incognito tab, the problem does not exist.

Can anyone help us with this very specific problem?

I was able to find the solution for the problem by myself. I believe since ionic v4 It is no longer necessary to think about cache busting, because it is build in. But only if you compile the project for production (–prod). Then the version will be automatically included as a hash.