web-infra-dev / rspack

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

[Bug]: Incorrect html output when using compilation hooks and upper case letters in asset file names #8410

Open mochiya98 opened 3 days ago

mochiya98 commented 3 days ago

System Info

System Info ``` System: OS: macOS 15.0 CPU: (11) arm64 Apple M3 Pro Memory: 57.17 MB / 18.00 GB Shell: 3.2.57 - /bin/bash Binaries: Node: 20.15.0 - ~/.anyenv/envs/nodenv/versions/20.15.0/bin/node Yarn: 1.22.22 - ~/.anyenv/envs/nodenv/versions/20.15.0/bin/yarn npm: 10.7.0 - ~/.anyenv/envs/nodenv/versions/20.15.0/bin/npm pnpm: 9.12.3 - /opt/homebrew/bin/pnpm Browsers: Chrome: 130.0.6723.117 Edge: 130.0.2849.80 Safari: 18.0 npmPackages: @rspack/cli: ^1.1.0 => 1.1.0 @rspack/core: ^1.1.0 => 1.1.0 @rspack/plugin-react-refresh: 1.0.0 => 1.0.0 ```

Details

when not using hooks (valid):

<script src="/fooBar.js"></script>

when using hooks (invalid):

<script src="/foobar.js"></script><!-- 404 -->

This could be the cause: https://github.com/web-infra-dev/rspack/blob/17e1e38a9b6b026940e704a14de42f496266cbfd/crates/rspack_binding_values/src/html.rs#L59

Reproduce link

No response

Reproduce Steps

Create a rspack project to output assets that contain uppercase letters, e.g.:

{
  entry: {
    foorBar: "./src/main.js",
  },
}

and add plugin includes rspack.HtmlRspackPlugin hooks https://rspack.dev/blog/announcing-1-1#improved-html-plugin

inottn commented 1 day ago

Yes, it should not be lowercased here; this task should be left to the minifier.