npm i --save-dev html-webpack-plugin-add-asset-version yarn add --dev html-webpack-plugin-add-asset-versionthe plugin will add a version number to the specified file , In order to prevent bugs caused by caching problems.
const HtmlWebpackPlugin = require('html-webpack-plugin');
const AddAssetVersion = require('html-webpack-plugin-add-asset-version');
const webpackConfig = {
entry: 'index.js',
output: {
path: 'dist',
filename: 'index_bundle.js',
},
plugins: [
new HtmlWebpackPlugin(),
new AddAssetVersion({ noCacheFilesName: ['test.js','test.css'] }),
],
};