ts-namespace-import-plugin icon indicating copy to clipboard operation
ts-namespace-import-plugin copied to clipboard

how this be made to work to import files from current project using relative paths?

Open adrian-gierakowski opened this issue 1 year ago • 1 comments

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

adrian-gierakowski avatar Jan 20 '24 12:01 adrian-gierakowski

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 :)

snatvb avatar Jan 31 '24 11:01 snatvb