ts-namespace-import-plugin
ts-namespace-import-plugin copied to clipboard
how this be made to work to import files from current project using relative paths?
let's say I have a module in my project at: ./MyModule.ts
I would like to have it auto imported from anywhere within my project using a relative path, for example:
from ./OtherModule.ts
as:
import * as MyModule from './MyModule'
and from ./nested/OtherModule.ts
as:
import * as MyModule from '../MyModule'
Currently If I configure the plugin with:
"namespaces": {
"MyModule": {
"importPath": "./MyModule"
}
}
the imports always use the literal './MyModule'
regardless of where I import from
I think you can resolve it easier and don't wait the feature
just add alias to paths: "~/*": "src"
"namespaces": {
"MyModule": {
"importPath": "~/lib/my-module"
}
}
I didn't check it, but maybe it will works and helps you :)