Post

It's very hard to innovate on module resolution in JS because the TS user experience would be bad. TypeScript needs something like content mappers, but for module resolution—you specify an npm package in a tsconfig and then TS sends it the raw specifier and referrer info to resolve.

I feel like this is close; 7.1 API has the concept of a "static resolution" object where the entire thing can be provided up front, and likely could have done what Deno wanted, could be used for PnP (or the new package map thing, though probably we'd just implement that directly)

Yeah, in Deno's case that would have be ideal because it required some weird stuff for JSR. Doing it that way probably supports the most scenarios, but then the resolution code might be doing more work like loading & parsing files in addition to TypeScript loading & parsing files.

I feel like content mappers could have been a solution where you can do what content mapping does today and also do resolution/loading/auto-imports/path completions. These might not work as optimally in the future if not thought about/implemented at the same time.

0 reposts0 likes