import {} from "./mod.js"
You have to write: import {} from "./mod.ts"
ESbuild doesn't transform source imports. Thus, by transpiling your code using ESbuild, you get an erroneous import that leads to a runtime error in browsers and Node. The case is worse for TypeScript, because it refuses to tarnspile this code.By the way, bundling with ESbuild is possible, however when you write a library you generally want to transpile the code, not to bundle it.
import {} from "./mod“;
and we bundle before running. Maybe that explains it.TSC recently added a flag that allows “.ts” imports too.
Yes, ESbuild correctly resolves the path, however it doesn't rewrite the import path. Thus, you end with a javascript file that tries to import a typescript file (this leads to a runtime error in the browser and Node).
> TSC recently added a flag that allows “.ts” imports too.
For type-checking only. You cannot emit code when using `ts` extension.