Are there any plans to support different methods of module resolution in TypeScript's compiler?
For example, when you
in Node.js, it looks in the
subdirectory, checks for a
, and does a few other quirky things to locate the module. When using RequireJS, its behavior is driven by a config file which often re-maps module locations from one path to
If TypeScript's compiler were to support module resolution plugins, these plugins could locate .ts and .d.ts files using Node.js's or RequireJS's behavior. You could do something like:
npm install foo
tsc --module commonjs --module-resolution nodejs myCode.ts
Any node modules installed via npm can contain their own .d.ts files which will be found by TypeScript's compiler thanks to the "nodejs" module resolver.
Projects like DefinitelyTyped can benefit as well. If done correctly, the end-user can avoid some redundant ///<require... comments.
This relates to