Socket
Socket
Sign inDemoInstall

typescript-transform-paths

Package Overview
Dependencies
Maintainers
1
Versions
59
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

typescript-transform-paths

Transforms absolute imports to relative


Version published
Maintainers
1
Created
Source

typescript-transform-paths

npm version Conventional Commits code style: prettier Built with Spacemacs

Transforms absolute imports to relative from paths in your tsconfig.json

Install

$ npm i -D typescript-transform-paths

Usage with ttypescript

Add it to plugins in your tsconfig.json

{
  "compilerOptions": {
    "baseUrl": "./",
    "paths": {
      "@utils/*": ["utils/*"]
    },
    "plugins": [{ "transform": "typescript-transform-paths" }]
  }
}

Example

// tsconfig.json
{
  "compilerOptions": {
    "baseUrl": "./",
    "paths": {
      "@utils/*": ["utils/*"]
    }
  }
}
// core/index.ts
import { sum } from "@utils/sum";

sum(2, 3);

Gets compiled to:

// core/index.js
var sum_1 = require("../utils/sum");
sum_1.sum(2, 3);

Contributing

If you have any question or idea of a feature create an issue in github or make an PR.

FAQs

Package last updated on 12 Apr 2019

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