web-infra-dev / rspack

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

[Bug]: Favicon setting in html plugin does not work correctly when output.publicPath: "auto" #8412

Closed mochiya98 closed 1 week ago

mochiya98 commented 1 week 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 output.publicPath:“auto”, the html plugin outputs the following tag:

<link href="dist/favicon.svg" rel="icon" />

but it should be as follows:

<link href="favicon.svg" rel="icon" />

Reproduce link

No response

Reproduce Steps

config like this:

{
  output: {
    publicPath: "auto"
  },
  plugins: [
    new rspack.HtmlRspackPlugin({
      favicon: "./src/favicon.svg",
    })
  ]
}