when setting:
"configurations": {
"production": {
...
"outputHashing": "all",
...
}
}
I get something like: styles.1e072cee432cd678e43c.css
Is there a way to get this result: styles.css?1e072cee432cd678e43c ?
The hash is calculated based on the contents of each bundle - so it can (but doesn't have to) change on each build. It's calculated by the webpack at build-time, so there's no easy way to pre-calculate it.
If I needed the hash for some reason (i.e. for some CI/CD stuff) I'd probably use an NPM Post Script to read the contents of the output directory. So, in your package .json where you have your scripts, you probably have a build
one. If you add a postbuild
script, it will be run after the build was run. Or, if you have build-prod
script you would need postbuild-prod
respectively, etc.
Concerning the contents of the script - there's no universal answer, as it depends on your build configuration (i.e. which files do you need? style only? others? do you use namedChunks? where will be the files outputted? etc.) and your shell (i.e. it might cmd or powershell on windows machine, or some kind of bash on linux, or something else entirely). For that you're probably better off creating a new question tagged with your shell of choice.