These snippets were created after reading the following article on how to use webpack to build code bundles for individual JSP pages, and specifically how to get those JSP pages to refer to the correct filename + hash.
https://medium.com/@jsilvax/introducing-webpack-into-an-existing-java-based-web-app-ff53f14d37ec
There was no actual code, but the description of the approach was enough to put something together.
jsilvax just posted some code here: https://medium.com/p/510d859b9f36/responses/show
When you write a TLD lib that has functions, those function calls are static, meaning there's no way that class is going to know your Serlvet context. So, you just have to pass that in as an argument so that the function can open the manifest file.