As discussed elsewhere, the following pattern is the only syntactically valid way to refer to external resources from JavaScript. As such, we should support this in order to allow npm modules to refer to non-JavaScript resources. I believe Webpack 5 has started supporting this too, so we're in good company.
const img = document.createElement('img');
img.src = new URL('./my-image.svg', import.meta.url);
document.body.appendChild(img);
As discussed elsewhere, the following pattern is the only syntactically valid way to refer to external resources from JavaScript. As such, we should support this in order to allow npm modules to refer to non-JavaScript resources. I believe Webpack 5 has started supporting this too, so we're in good company.