webpack-webextension-plugin
webpack-webextension-plugin copied to clipboard
Is it possible to set the content scripts file name?
Ideally I would like to have the content hash as part of the file name for the scripts '[contenthash]-[name].js', but I don't see anything about this accepting webpack output config, paths, or names, or accepting webpack template strings.
Is this possible, or does the script name have to be something that is predetermined?
Can you let me know the thinking on this?
The main idea I had behind it is that it allows me to quickly verify that the CI/CD pipeline consistently builds the same thing each time without having to use any file diffing tools. In the past The CI/CD pipeline would fail to pull in a dependency and thus when Firefox AMO reviewers would review the extension they would catch this when they diffed the files.
So this would allow us to leverage content hashes to quickly validate that the file contents are the same or not as part of QA. Webpack allows for using various tokens as part of the output for not only chunks, but also the entry scripts, it would be nice if this supported that as well. It would take some transformation in the manifest though, to transform from static name to the output file name
I see. It looks like I would implement https://github.com/webpack/webpack/blob/main/lib/TemplatedPathPlugin.js to get this done
Isn't that what Webpack already uses when you provide a file name like '[contenthash]-[name].js' as the output.filename? The thing is that the manifest.json doesn't know about the dynamic part of that. So the file name just has to be content.js as the entry and the output file name. If I have the output.filename include a template token the manifest.json would still just have content.js instead of output file name: abc134-content.js
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.