Hmm good point about the subfolder.
But…Discourse.asset_host can be nil and I’ve never heard of Discourse.base_prefix ?
How about this:
importScripts("<%= (Discourse.asset_host || GlobalSetting.relative_url_root) + "/javascripts/workbox/workbox-sw.js" %>");
modulePathPrefix: "<%= (Discourse.asset_host || GlobalSetting.relative_url_root) + "/javascripts/workbox" %>",