css-minimizer-webpack-plugin icon indicating copy to clipboard operation
css-minimizer-webpack-plugin copied to clipboard

Hash output asset.css does not change

Open cap-Bernardito opened this issue 4 years ago • 1 comments

  • Operating System: Ubuntu
  • Node Version: 12.16.1
  • NPM Version: 6.14.7
  • webpack Version: 4 / 5
  • css-minimizer-webpack-plugin Version: 1.0.0

Expected Behavior

  1. Run webpack with the provided config
  2. Get output asset entry.40909804e9379fa0a37f.css
  3. Change minimizerOptions
  4. Run webpack
  5. Get output asset entry.other_hash.css

Actual Behavior

  1. Run webpack with the provided config
  2. Get output asset entry.40909804e9379fa0a37f.css
  3. Change minimizerOptions
  4. Run webpack
  5. Get output asset entry.40909804e9379fa0a37f.css

Hash does not change.

Code

module.exports = {
  ...
  module: {
    loaders: [
      {
        test: /.s?css$/,
        use: [MiniCssExtractPlugin.loader, 'css-loader', 'sass-loader'],
      },
    ],
  },
  plugins: [
    new MiniCssExtractPlugin({
      filename: '[name].[contentHash].css',
      chunkFilename: '[id].[name].[contentHash].css',
    }),
  ],
  optimization: {
    minimize: true,
    minimizer: [
      new CssMinimizerPlugin({
        minimizerOptions: {
          // When we change these options, the hash of the asset should also change
          preset: ['default', { discardEmpty: false }],
        },
      })
    ],
  },
};

cap-Bernardito avatar Aug 01 '20 15:08 cap-Bernardito

We have also encountered this issue and hope that the plugin can support content hash updates.

yanghuabei avatar Sep 14 '23 13:09 yanghuabei