https://github.com/arzyu/resolve-ts-aliases
Resolve aliases for integrating webpack and typescript.
https://github.com/arzyu/resolve-ts-aliases
typescript-webpack webpack-typescript
Last synced: 10 months ago
JSON representation
Resolve aliases for integrating webpack and typescript.
- Host: GitHub
- URL: https://github.com/arzyu/resolve-ts-aliases
- Owner: arzyu
- Created: 2019-09-10T10:02:31.000Z (almost 7 years ago)
- Default Branch: master
- Last Pushed: 2021-08-17T14:32:20.000Z (almost 5 years ago)
- Last Synced: 2025-08-12T02:19:36.131Z (10 months ago)
- Topics: typescript-webpack, webpack-typescript
- Language: TypeScript
- Homepage:
- Size: 2.93 KB
- Stars: 9
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# resolve-ts-aliases
Resolve aliases for integrating webpack and typescript.
## Install
```bash
npm add -D resolve-ts-aliases
```
## Usage
`tsconfig.json`:
```json
{
"compilerOptions": {
"baseUrl": "./",
"paths": {
"@app/*": ["src/app/*"],
"@components/*": ["src/components/*"]
}
}
}
```
`webpack.config.ts`:
```ts
import path from "path";
import webpack from "webpack";
import { resolveTsAliases } from "resolve-ts-aliases";
const config: webpack.Configuration = {
resolve: {
// These 2 forms are equivalent.
alias: resolveTsAliases(path.resolve("tsconfig.json")),
alias: {
"@app": "/path/to/src/app",
"@components": "/path/to/src/components"
}
},
};
export default config;
```
## Recommendation
For **webpack users**, you could try another package I developed, [airpack](https://github.com/arzyu/airpack), which can help you share webpack configuration in multiple projects more easily.