web-infra-dev / rspack

The fast Rust-based web bundler with webpack-compatible API 🦀️
https://rspack.dev
MIT License
10.05k stars 573 forks source link

[Bug]: Contenthash remains the same when content changes #8431

Closed cblagg closed 4 days ago

cblagg commented 1 week ago

Details

When using rspack.CssExtractRspackPlugin and configuring file names with [contenthash], the same resulting filename is observed even when the content of the file changes.

This behavior is unexpected, particularly when using realContentHash: true - where I understand it should calculate this hash from the actual content of the file.

Reproduce link

https://github.com/cblagg/rspack-css-contenthash-repro/tree/main

Reproduce Steps

Steps to reproduct:

  1. npm i
  2. Run: CSS_MINIFIER=rspack npm run build
  3. Run: CSS_MINIFIER=webpack npm run build
  4. Observe .css files in each of dist/rspack and dist/webpack have differing content but share the same name

System Info

System:

Binaries:

Browsers:

npmPackages: