https://github.com/cyansalt/typescript-transform-aliases
Transform aliases in TypeScript files.
https://github.com/cyansalt/typescript-transform-aliases
typescript
Last synced: about 1 year ago
JSON representation
Transform aliases in TypeScript files.
- Host: GitHub
- URL: https://github.com/cyansalt/typescript-transform-aliases
- Owner: CyanSalt
- License: isc
- Created: 2021-01-19T04:46:45.000Z (over 5 years ago)
- Default Branch: main
- Last Pushed: 2024-12-27T06:14:23.000Z (over 1 year ago)
- Last Synced: 2025-04-28T15:58:42.288Z (about 1 year ago)
- Topics: typescript
- Language: TypeScript
- Homepage:
- Size: 357 KB
- Stars: 2
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# typescript-transform-aliases
[](https://www.npmjs.com/package/typescript-transform-aliases)
Transform aliases in TypeScript files.
## Install
```sh
npm i -D typescript-transform-aliases
# or
yarn add -D typescript-transform-aliases
```
## Usage
With [ttypescript](https://github.com/cevek/ttypescript/) or [ts-patch](https://github.com/nonara/ts-patch)
```json
{
"compilerOptions": {
"plugins": [
{
"transform": "typescript-transform-aliases",
"after": true,
"afterDeclarations": true,
"aliases": {
// for example
"^lodash-es$": "lodash"
}
}
]
}
}
```
## Similar packages
- [typescript-transform-paths](https://github.com/LeDDGroup/typescript-transform-paths)
- [@zerollup/ts-transform-paths](https://github.com/zerkalica/zerollup/tree/master/packages/ts-transform-paths/)
- [ts-transform-import-path-rewrite](https://github.com/dropbox/ts-transform-import-path-rewrite)
Both `typescript-transform-paths` and `@zerollup/ts-transform-paths` transform the `paths` field in `tsconfig.json`, which are usually aliases for **relative** paths;
`ts-transform-import-path-rewrite` could transform any aliases but does not support `require` or dynamic imports.