exhibitionist-digital / ultra

Zero-Legacy Deno/React Suspense SSR Framework
https://ultrajs.dev
MIT License
2.99k stars 65 forks source link

fix: support compiling remote sources in dev #258

Closed deckchairlabs closed 1 year ago

deckchairlabs commented 1 year ago

Prefixing an importSpecifier with @ultra/ in your importMap will now allow importing remote files that would usually require transpiling for the browser.

eg.

{
  "imports": {
    // Your other imports
    "@ultra/qrcode/": "https://deno.land/x/qrcode@v2.0.0/"
  }
}

When the importMap is injected in the HTML stream sent to the browser during dev mode, the import https://deno.land/x/qrcode@v2.0.0/ will be rewritten to /_ultra/compiler/https%3A%2F%2Fdeno.land%2Fx%2Fqrcode%40v2.0.0%2F/

The compiler middleware will then fetch that remote file and transpile as if it was a local file!

mashaal commented 1 year ago

Insanity!! <3