I did not find any mention in the HTML specification and anywhere on the Internet that says it is possible, but I still ask just in case. Is it possible to get the module url, for example, to extract the files with respect to that url?
Say my index.html has <script type="module">import '/foo/foo.js'</script> and foo.js wants to know that it has a url to dynamically load some file, for example. ./file-inside-foo . At the time of this writing, document.currentScript returns null inside modules and probably looks like this by design?
source share