import-map-overrides
import-map-overrides copied to clipboard
Infer same filename with port number

Expected behavior: inferred filename is main.js
Actual behavior: inferred file name is platform-ui-analytics.js
Note: URL pattern from original (non-overriden URL) is //mydomain.com/@platform-ui/analytics/{x.y.z}-canary-{hash}/main.js
You can implement this behavior yourself by overriding the getUrlFromPort
hook: https://github.com/joeldenning/import-map-overrides/blob/master/docs/api.md#geturlfromport
However, I agree that this would be a sensible default. Do you have interest in implementing it? Here's the code to change:
https://github.com/joeldenning/import-map-overrides/blob/8869268bb3b393af2b1a2e4e49b7a2fe84e13ba4/src/api/js-api.js#L157-L160
I ended up pivoting my solution a bit here. Instead of overriding from localhost, I added a build step to pull request builds to publish artifacts to our CDN and use those for overrides. This approach also solves SSL problems you can run into (loading http resources from an https website). I no longer have a need for this functionality.