error: TypeScript files are not supported in npm packages:

I am wondering why I cannot import a .ts file from a
node_modules
directory.

If I could do this then I could use npm as a package manager which would allow me to take advantage of the things that I love about deno as well as being able to work with modules in a familiar way (eg. bundle templates, stylesheets, static assets, whatnot alongside the scripts).

eg.
import { foo } from "./node_modules/abc/main.ts";
foo();

or
import { foo } from "@abc/main.ts";
foo();
Was this page helpful?