Skip to content

Commit fce450a

Browse files
committed
docs: add readme
1 parent e774cf7 commit fce450a

File tree

1 file changed

+59
-0
lines changed

1 file changed

+59
-0
lines changed

README.md

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
# typescript-transform-paths
2+
3+
[![npm version](https://img.shields.io/npm/v/typescript-transform-paths.svg)](https://www.npmjs.com/package/typescript-transform-jsx)
4+
[![Conventional Commits](https://img.shields.io/badge/Conventional%20Commits-1.0.0-yellow.svg)](https://conventionalcommits.org)
5+
[![code style: prettier](https://img.shields.io/badge/code_style-prettier-ff69b4.svg?style=flat-square)](https://github.com/prettier/prettier)
6+
[![Built with Spacemacs](https://cdn.rawgit.com/syl20bnr/spacemacs/442d025779da2f62fc86c2082703697714db6514/assets/spacemacs-badge.svg)](http://spacemacs.org)
7+
8+
Transforms absolute imports to relative
9+
10+
## Install
11+
12+
```sh
13+
$ npm i -D typescript-transform-paths
14+
```
15+
16+
## Usage with [ttypescript](https://github.com/cevek/ttypescript/)
17+
18+
Add it to _plugins_ in your _tsconfig.json_
19+
20+
```json
21+
{
22+
"compilerOptions": {
23+
"plugins": [{ "transform": "typescript-transform-paths" }]
24+
}
25+
}
26+
```
27+
28+
## Example
29+
30+
```json
31+
// tsconfig.json
32+
{
33+
"compilerOptions": {
34+
"baseUrl": "./",
35+
"paths": {
36+
"@utils/*": ["utils/*"]
37+
}
38+
}
39+
}
40+
```
41+
42+
```tsx
43+
// core/index.ts
44+
import { sum } from "@utils/sum";
45+
46+
sum(2, 3);
47+
```
48+
49+
Gets compiled to:
50+
51+
```js
52+
// core/index.js
53+
var sum_1 = require("../utils/sum");
54+
sum_1.sum(2, 3);
55+
```
56+
57+
## Contributing
58+
59+
If you have any question or idea of a feature create an issue in github or make an PR.

0 commit comments

Comments
 (0)