Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
developit opened this issue Dec 17, 2020 · 0 comments
Open

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

developit opened this issue Dec 17, 2020 · 0 comments
Labels
architecture enhancement New feature or request filetypes Non-module files

Comments

@developit
Copy link
Member

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);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
architecture enhancement New feature or request filetypes Non-module files
1 participant