Trouble with imports


#1

I’m trying to figure out how to import one of my typescript classes into another using a non-relative path. I have a bunch of imports that look like this:

import { User } from "../../shared/user/user";

I’d like them to look more like this for easier maintainability:

import { User } from "shared/user/user";
// or even
import { User } from "~/shared/user/user";

My current tsconfig.json contains these values for baseUrl and paths (I’ve tried other values with no success):

"baseUrl": ".",
"paths": {
  "*": [
    "./node_modules/tns-core-modules/*",
    "./node_modules/*",
  ]
}

#2

bump. Any ideas for this?


#3

Upon upgrading to NS CLI 4.0.2, the following was automatically added to my tsconfig.json’s “paths” entry:

"~/*": [
      "app/*"
]

This allows the non-relative imports I asked about above. (I thought this new entry was one that I’ve tried in the past, but I must have not had it quite right).