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鈥檒l occasionally send you account related emails.
Already on GitHub? Sign in to your account
Javascript "new URL('...', import.meta.url)" syntax not working #7633
Comments
I'm trying to do a similar thing to import an const info = new URL('info.svg', import.meta.url); but at runtime I get
where the generated code is: const info = new URL(require("10550ed8cba4ef4f")); This error, together with #7587, makes it impossible? to embed svgs in react components |
I don't think that's necessarily a bug, yet -- did you try However, I wonder if you still have issues like I have in #7643 ? |
I've also tried to use the url directly in the jsx element, but there is no transformation performed in the resulting bundle (so the image cannot be found). I have the same issue as you have in #7643. |
I'd also like to note that it seems Parcel removes the hash (#) and search (?) from the url, which can be problematic for .svg's that need to reference an id within the svg:
|
this is still an open issue, would love to see movement/resolution. Thanks |
Still no updates, it seems. |
Can someone provide a complete code sample](https://minimum-reproduction.wtf/)? |
馃悰 Bug report
new URL('foo.jpg', import.meta.url)
compiles without error, but throws a ERR_INVALID_URL error when run.馃帥 Configuration (.babelrc, package.json, cli command)
No
.babelrc
, no.parceljs
.package.json
is at defaultnpm init -y
state.I'm just running
parcel build index.js
馃 Expected Behavior
new URL('foo.jpg', import.meta.url)
compiles down tonew URL("foo.d7483e92.jpg")
馃槸 Current Behavior
馃拋 Possible Solution
???
馃敠 Context
I'm trying to use svg images in my web app, which are transformed into png images by a custom transformer plugin. I'm using query parameters.
new URL('...', import.meta.url)
seems like the best way to do this.馃捇 Code Sample
馃實 Your Environment
The text was updated successfully, but these errors were encountered: