typescript-paths
TypeScript icon, indicating that this package has built-in type declarations

1.5.1 • Public • Published

typescript-paths

Latest Version

Resolving tsconfig paths in runtime

npm install typescript-paths
const { register } = require("typescript-paths")
register()

Example tsconfig.json

{
  "compilerOptions": {
    "paths": {
      "~/*": ["./*"]
    }
  }
}

Then you can import alias instead of annoying path

// const App = require("../../../../App")
const App = require("~/App")

Options

tsConfigPath (string | string[])

Specify the path where your TypeScript configuration file.

If not set:

  • use Environment variable TS_NODE_PROJECT
  • or search tsconfig.json in current working directory.

logLevel ("none" | "error" | "warn" | "info" | "debug" | "trace") (default: "info")

Set the logging level on the plugin.

fallback (function (string): string | undefined)

The handler to handle unusual module name.

color (boolean) (default: true)

Colorful ouput.

respectCoreModule (boolean) (default: true)

reference

Package Sidebar

Install

npm i typescript-paths

Weekly Downloads

34,110

Version

1.5.1

License

MIT

Unpacked Size

36 kB

Total Files

20

Last publish

Collaborators

  • lightyen