rspack
rspack copied to clipboard
[Bug]: license-webpack-plugin will not replace "[name]" in "outputFilename"
System Info
@rspack/core: 1.0.5
license-webpack-plugin: 4.0.2
Details
The default value for outputFilename
in license-webpack-plugin
is '[name].licenses.txt'
;
however, perChunkOutput
enabled or not, the '[name]'
will not be replaced at all, resulting in
license-webpack-plugin
to only generate one [name].licenses.txt
[sic] file and just keep overwriting it.
I did some debugging,
https://github.com/xz64/license-webpack-plugin/blob/32bf7a4cca560f05ed72b6b3aba47c3a7dd1f290/src/WebpackAssetManager.ts#L53-L54
https://github.com/web-infra-dev/rspack/blob/7cddc1733948ea707cfe38a391754a3e18c981b1/packages/rspack/src/Compilation.ts#L889
indeed the compilation
object only has a hash
property, therefore getPath
will only replace [hash]
and nothing else;
Webpack 5 does replace [name]
though.
Interestingly I also use the built in CssExtractRspackPlugin
plugins: [
...
new rspack.CssExtractRspackPlugin({
filename: './style/[name].min.css',
}),
],
which does replace [name]
though; I wonder what's the difference?
Meantime perhaps we should add a note in https://rspack.dev/guide/compatibility/plugin#plugin-compatibility?
Reproduce link
No response
Reproduce Steps
Just add
import { LicenseWebpackPlugin } from 'license-webpack-plugin;
...
plugins: [
...
new LicenseWebpackPlugin(),
],
...
to any rspack config. The output license file would be [name].license.txt
[sic].