How to add URL Dependencies dynamically using Parcel? #9950
Unanswered
Rock-n-Roll-CRC
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Problem: I use Parcel as a bundler of my project and try to inject HTML markup into my index.html from my TypeScript file. Injected markup contains elements with dynamically resolved paths for their src attribute. The paths I'm trying to add to the images' src attributes are stored as properties of my data.json file, which I import directly into my TypeScript file. The problem is that Parcel support only string literals inside new URL() syntax, therefore I don't know how to use template literals/variables inside this function to add dynamic URL dependencies.
Code:
What I've tried: I tried using template literals, variables inside new URL() function, but it was in vain, since Parcel doesn't support anything else than string literals inside of it.
Beta Was this translation helpful? Give feedback.
All reactions