# vite-plugin-tsconfig-paths2

> Vite resolver for TypeScript compilerOptions.paths

Latest version **0.0.4** (published 2023-11-17) · MIT license · 0 weekly downloads

## Install

```sh
npm install vite-plugin-tsconfig-paths2
pnpm add vite-plugin-tsconfig-paths2
yarn add vite-plugin-tsconfig-paths2
bun add vite-plugin-tsconfig-paths2
```

## Health

**Score 30/100 (F)** — status: abandoned.

Positive: has types; esm support; no vulnerabilities; high quality score.

Warnings: low downloads; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.0.4 |
| Published | 2023-11-17 |
| First published | 2023-11-16 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 2 |
| Unpacked size | 13.1 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | baicie |
| Maintainers | baicie2 |
| Keywords | vite, resolver, tsconfig, paths |

## Links

- npm: https://www.npmjs.com/package/vite-plugin-tsconfig-paths2
- Repository: https://github.com/ikunOrg/vite-tsconfig-path
- Homepage: https://github.com/ikunOrg/vite-tsconfig-path#readme
- Issues: https://github.com/ikunOrg/vite-tsconfig-path/issues
- npm.io page: https://npm.io/package/vite-plugin-tsconfig-paths2

## Dependencies (2)

- [debug](https://npm.io/package/debug.md) ^4.3.4
- [tsconfck](https://npm.io/package/tsconfck.md) ^3.0.0

## Alternatives

- [base64url](https://npm.io/package/base64url.md) — 6.1M weekly downloads
- [get-installed-path](https://npm.io/package/get-installed-path.md) — 502.9K weekly downloads
- [@uppy/url](https://npm.io/package/@uppy/url.md) — 185.8K weekly downloads
- [@d3fc/d3fc-shape](https://npm.io/package/@d3fc/d3fc-shape.md) — 16.2K weekly downloads
- [localizer](https://npm.io/package/localizer.md) — 226 weekly downloads

## Recent versions

- 0.0.4 (latest) — 2023-11-17
- 0.0.3 — 2023-11-17
- 0.0.2 — 2023-11-17
- 0.0.1 — 2023-11-16

## README

将tsconfig配置中的paths提取出来放到resolve.alias中 图一乐欢迎尝试


```
npm i vite-plugin-tsconfig-paths2 -D
```
```typescript
import { defineConfig } from "vite";
import vue from "@vitejs/plugin-vue";
import tsconfigPath from "vite-plugin-tsconfig-path";

// https://vitejs.dev/config/
export default defineConfig({
  plugins: [vue(), tsconfigPath()],
});

```
```json
{
  "compilerOptions": {
    "target": "ES2020",
    "useDefineForClassFields": true,
    "module": "ESNext",
    "lib": ["ES2020", "DOM", "DOM.Iterable"],
    "skipLibCheck": true,

    "moduleResolution": "bundler",
    "allowImportingTsExtensions": true,
    "resolveJsonModule": true,
    "isolatedModules": true,
    "noEmit": true,
    "jsx": "preserve",

    "strict": true,
    "noUnusedLocals": true,
    "noUnusedParameters": true,
    "noFallthroughCasesInSwitch": true,
    "baseUrl": ".",

    "paths": {
      "@/*": ["src/*"], 
    }
  },
  "include": ["src/**/*.ts", "src/**/*.d.ts", "src/**/*.tsx", "src/**/*.vue"],
  "references": [{ "path": "./tsconfig.node.json" }]
}

```
```vue
<script setup lang="ts">
import HelloWorld from "@/components/HelloWorld.vue";
</script>

<template>
  <div>
    <a href="https://vitejs.dev" target="_blank">
      <img src="/vite.svg" class="logo" alt="Vite logo" />
    </a>
    <a href="https://vuejs.org/" target="_blank">
      <img src="./assets/vue.svg" class="logo vue" alt="Vue logo" />
    </a>
  </div>
  <HelloWorld msg="Vite + Vue" />
</template>

<style scoped>
.logo {
  height: 6em;
  padding: 1.5em;
  will-change: filter;
  transition: filter 300ms;
}
.logo:hover {
  filter: drop-shadow(0 0 2em #646cffaa);
}
.logo.vue:hover {
  filter: drop-shadow(0 0 2em #42b883aa);
}
</style>

```

---
_Source: https://npm.io/package/vite-plugin-tsconfig-paths2 · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
