How to get the direct path to a Webpacker pack
If you are making use of a serviceworker to cache JS or CSS or you’re rendering some JS server-side you have to have the full path to the file.
If, at the same time, you’re using Webpacker to generate your assets, it’s not obvious how to get the full path to the pack
After some searching through the docs I found that it’s like this:
It seems that this API changed recently so most of the previous search results refer to the previous API. Hopefully this gets picked up and saves others from experimentation and googling that I had to go through.
Get in touch
Or send me feedback. It will take less than 20 seconds.