Skip to content

Hash output asset.css does not change #14

Open
@cap-Bernardito

Description

@cap-Bernardito
  • 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 }],
        },
      })
    ],
  },
};

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions