I am trying to get work the module resolution under typescript.
If I have:
/modulename/index.ts
should it be resolved by:
import * as modulename from "modulename"
?
I can't get it work. But
import * as modulename from "modulename/index"
works well.
Edit
as aluan-haddad recommended me it is neccessary to have the tsc configured properly.
This one worked for me:
{
...
"baseUrl": ".",
"module": "commonjs",
"moduleResolution": "node",
...
}
Edit
Please note this configuration does not work when used with VS. If it is placed in external tsconfig file the compilation works well but language service can't handle it. If its is placed in msconfig (csporj) both, compiltion and language service fails.
Only the one solution I have found to be working for 100% is to create something like:
src
node_modules
module_being_currently_developed
submodules
In this case the module resolution works properly.