Skip to content
Transforms absolute imports to relative
Branch: master
Clone or download
Latest commit c4ab321 May 23, 2019
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
src fix: not transforming declaration files May 24, 2019
tests
.all-contributorsrc docs: add @sbmw as a contributor May 24, 2019
.editorconfig chore: add editorconfig Apr 12, 2019
.gitignore fix: not transforming declaration files May 24, 2019
.travis.yml
CHANGELOG.md
LICENSE docs: add license May 18, 2019
README.md
package-lock.json chore(release): 1.1.3 May 24, 2019
package.json chore(release): 1.1.3 May 24, 2019
test.sh fix: not transforming declaration files May 24, 2019
tsconfig.json fix: not transforming declaration files May 24, 2019

README.md

typescript-transform-paths

npm version Build Status Conventional Commits code style: prettier All Contributors

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

Contributors

Thanks goes to these wonderful people (emoji key):

Daniel Perez Alvarez
Daniel Perez Alvarez

💻 🚧 ⚠️
Михайлов Антон
Михайлов Антон

💻 🐛 ⚠️
Joshua Avalon
Joshua Avalon

🐛 📦
Robert Laverty
Robert Laverty

🐛 ⚠️
Ole Ersoy
Ole Ersoy

🐛
sbmw
sbmw

🐛

This project follows the all-contributors specification. Contributions of any kind welcome!

You can’t perform that action at this time.