ts-browser icon indicating copy to clipboard operation
ts-browser copied to clipboard

Supporting importmaps

Open Badestrand opened this issue 1 year ago • 1 comments

Hi

First, thanks for making this cool script to have typescript in the browser!

Without Typescript, the browsers support "importmap"s to easily load external resources:

<html>
<head>
<script type="importmap">
{
	"imports": {
		"random": "https://cdn.jsdelivr.net/npm/[email protected]/+esm",
	}
}
</script>

<script type="module">
import random from 'random'

...
</script>

Is there a chance we could support this here, too?

Also when I try to import the full url it doesn't work: import random from 'https://cdn.jsdelivr.net/npm/[email protected]/+esm' will attach a ".ts" ending and then can't find the url.

Badestrand avatar Mar 05 '23 05:03 Badestrand

Hm, I wonder how widely used this importmap thing is used. I doubt I'll have the resources to work on this thing anytime soon. PRs welcome I guess.

klesun avatar Mar 05 '23 17:03 klesun