dotland icon indicating copy to clipboard operation
dotland copied to clipboard

deno.land/x can't resolve jsxImportSource

Open yandeu opened this issue 2 years ago • 5 comments

In nano_jsx I would like to import the jsx-runtime like so:

{
  "compilerOptions": {
    "jsx": "react-jsx",
    "jsxImportSource": "https://deno.land/x/nano_jsx"
  }
}

But on deno run, this failes to resolve error: Module not found "https://deno.land/x/nano_jsx/jsx-runtime". Even though there is an index.ts file inside that directory and it contains the jsx-runtime.


It would be nice if deno.land/x would be able to resolve index.js and index.ts files from inside a jsx-runtime directory.

yandeu avatar Jun 26 '22 21:06 yandeu

Just create a file named https://deno.land/x/nano_jsx/jsx-runtime. Deno should default extension-less files to .js

lucacasonato avatar Jun 26 '22 21:06 lucacasonato

What if the file jsx-runtime is written in typescript?

yandeu avatar Jun 26 '22 22:06 yandeu

You reexport the ts file from the js file.

lucacasonato avatar Jun 26 '22 22:06 lucacasonato

Is there a working example?

I don't know if it works on deno.land/x but loading it from github fails:

error: Expected a JavaScript or TypeScript module, but identified a Unknown module. Importing these types of modules is currently not supported.
  Specifier: https://raw.githubusercontent.com/nanojsx/nano/jsx-runtime-deno/deno_lib/jsx-runtime

Probably because the content-type is text/plain?

yandeu avatar Jun 26 '22 23:06 yandeu

Is this somehow solvable without the use of an import map?

yandeu avatar Jun 28 '22 17:06 yandeu