New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@sprucelabs/path-resolver

Package Overview
Dependencies
Maintainers
8
Versions
25
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@sprucelabs/path-resolver

Enables support for paths in the compiler options of your tsconfig file.

  • 1.0.7
  • npm
  • Socket score

Version published
Weekly downloads
2
decreased by-90%
Maintainers
8
Weekly downloads
 
Created
Source

@sprucelabs/path-resolver

Add runtime support for the compilerOptions.paths of your tsconfig.json.

Installation

yarn install @sprucelabs/path-resolver

or

npm install @sprucelabs/path-resolver

And include this as the first 2 lines of your app:

import { register } from "@sprucelabs/path-resolver";
register({ tsConfigDirs: [__dirname] });

That's all!

Options

  • tsConfigDirs:string[] - The path to the directory containing your tsconfig, will try them each in order (helpful when building to a dir that changes relative to the tsconfig)
  • extensions:string[] - Extensions you want to load, defaults to Module.extensions, must have dot in them .js, .ts.

Example tsconfig.json

{
	"compilerOptions": {
		"baseUrl": "",
		"outDir": "build",
		"paths": {
			"#alias": ["new/path/relative/to/baseUrl"],
			"#aliasWithWildcard/*": ["new/path/one/*", "new/path/two/*"]
		}
	}
}

Example import

import path from "path";
import { register } from "@sprucelabs/path-resolver";
register({ tsConfigDirs: [path.join(__dirname, "..")] });

import MyThing from "#alias";
import { somethingElse } from "#aliasWithWildcard/path/passed/through";

Keywords

FAQs

Package last updated on 14 Apr 2020

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc