AljoschaMeyer
Working around imports without a file extension
I'm facing an apparent contradiction between the requirements for importing modules, and the import statements generated by jsx compilation.
The deno module docs cleary state that imports must explicitly specify a file extension:
It adopts browser-like module resolution, meaning that file names must be specified in full. You may not omit the file extension and there is no special handling ofWhen deno compiles jsx/tsx, it inserts import statements that violate this requirement:index.js
.import { add, multiply } from "./arithmetic.ts";
When using the automatic transforms, Deno will try to import a JSX runtime module that is expected to conform to the new JSX API and is located at eitherAs someone who is not deeply familiar with javascript/typescript tooling and modules, this leaves me completely stumped. I can successfully configure deno to use a custom jsx factory, but it refuses to compile due to faulty imports that it itself inserted and that I cannot seem to influence. To turn this into a question: help?jsx-runtime
orjsx-dev-runtime
. For example if a JSX import source is configured toreact
, then the emitted code will add this to the emitted file:import { jsx as _jsx } from "react/jsx-runtime";
4 replies