-
Notifications
You must be signed in to change notification settings - Fork 13
Proposal: import.meta.urlBase #16
Comments
I don't think encouraging URL resolution via the + operator is a direction we want to encourage, at least on the web. |
Would it be enough if there was an equivalent of |
Yep, I think that's a good direction. However it's unclear whether we can make a sync Hoping that making more progress on the import maps spec (as opposed to explainer) will make the issues there clearer and unblock progress. |
Ah, yes. Forgot about that part. :( |
@domenic could you perhaps elaborate on why you find issue with string concatenation relative to a parent? |
URL parsing is complicated and any attempts to replace it with just string concatenation are bug farms. For example, depending on whether |
All APIs that accept URLs will do their own URL parse. Given that If If users start the concatenation part with What other complexities are there? |
Closing as proposal is now stage 4 |
Many use cases around
import.meta.url
are based on relative loading of sibling paths toimport.meta.url
.These naturally end up quite unwieldy, for example loading a worker in the same folder:
or even:
Just like Node.js supports both
__filename
and__dirname
, if we had cross-platform support forimport.meta.urlBase
(name to be bikeshed further), then this could be simplified to:This could help in simplifying conventions around these sibling fetch cases.
The text was updated successfully, but these errors were encountered: