DEV - add ‘workbox’ to list of versioned JS packages (PR #10766)

‘workbox’ package is now written to a versioned directory, eg:


Additionally, config/public_js_versions.yml is created to allow the Rails app to easily have access to the pathnames, etc., and the versioned workbox is referenced from service-worker.js.erb


Looks good, I’m guessing you opted to have a second file containing the plugin versions because it was too tricky to extract that info from the JS module in Ruby?

I saw there was code to parse some of those other generated files (eg js_constants_spec.rb, but that felt a bit hacky and weird to me. But, yes, there is a risk the two files could get out of sync and so there is a trade-off.

Perhaps the answer is to write to a single YAML file to public/javascript/ and have loadScript load, parse and memoize that, and have the backend code refer to the same file?

I think as is is probably easier to reason about than with YAML in JS, that sounds complicated to handle in loadSCript.