Thanks Vlad, that works!
Any idea why the import works when the direct assignment doesn’t? Or is this just one of those ‘that-the-way-it-is, live with it’ things?
I do not know how the Icon component works but I suspect it just passes the iconUrl property into some dom element and then a browser tries to download it in order to display it in the UI. But when the browser sees a relative URL it composes an absolute one based on the current HTML page path, that’s why you can see a URL which it not actually relative to the component.
But when you import it using JS code it goes into the component build and composes a correct URL.
So the right way is to use the import to have a correct URL.