Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: license-webpack-plugin will not replace "[name]" in "outputFilename" #7960

Open
Agritite opened this issue Sep 24, 2024 · 0 comments · May be fixed by #8032
Open

[Bug]: license-webpack-plugin will not replace "[name]" in "outputFilename" #7960

Agritite opened this issue Sep 24, 2024 · 0 comments · May be fixed by #8032
Assignees
Labels
bug Something isn't working

Comments

@Agritite
Copy link

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

return this.#inner.getPath(filename, data);

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].

@Agritite Agritite added bug Something isn't working pending triage The issue/PR is currently untouched. labels Sep 24, 2024
@LingyuCoder LingyuCoder self-assigned this Sep 30, 2024
@LingyuCoder LingyuCoder removed the pending triage The issue/PR is currently untouched. label Sep 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants