Skip to content

Support new URL('x', import.meta.url) in production #260

@developit

Description

@developit

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);

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions