vite-tsconfig-paths
Advanced tools
Comparing version 3.2.0 to 3.2.1
{ | ||
"name": "vite-tsconfig-paths", | ||
"version": "3.2.0", | ||
"version": "3.2.1", | ||
"description": "Vite resolver for TypeScript compilerOptions.paths", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
@@ -17,15 +17,13 @@ # vite-tsconfig-paths | ||
```ts | ||
import type { UserConfig } from 'vite' | ||
import tsconfigPaths from 'vite-tsconfig-paths' | ||
```ts | ||
import { defineConfig } from 'vite' | ||
import tsconfigPaths from 'vite-tsconfig-paths' | ||
const config: UserConfig = { | ||
plugins: [ | ||
tsconfigPaths(), | ||
], | ||
} | ||
export default defineConfig({ | ||
plugins: [ | ||
tsconfigPaths(), | ||
], | ||
}) | ||
``` | ||
export default config | ||
``` | ||
**Note:** You need to restart Vite when you update your `paths` mappings. | ||
@@ -35,5 +33,5 @@ | ||
- `root: string` | ||
The root directory to load `tsconfig.json` from. | ||
Defaults to `viteConfig.root` | ||
- `projects: string[]` | ||
The root directories to load `tsconfig.json` from. | ||
Defaults to `[viteConfig.root]` | ||
@@ -50,8 +48,24 @@ - `extensions: string[]` | ||
### checkJs | ||
### allowJs | ||
If your `tsconfig.json` file has `"checkJs": true` in it, path resolution will be expanded beyond TypeScript modules. The following extensions will have their imports resolved by this plugin: `.vue`, `.svelte`, `.mdx`, `.mjs`, `.js`, `.jsx` | ||
If your `tsconfig.json` file has `"allowJs": true` in it, path resolution will be expanded beyond TypeScript modules. The following extensions will have their imports resolved by this plugin: `.vue`, `.svelte`, `.mdx`, `.mjs`, `.js`, `.jsx` | ||
| ||
### baseUrl only | ||
If the `baseUrl` is defined but not `paths`, the `baseUrl` will be prepended to all bare imports, and its resolution will take precedence over node_modules. This is also how TypeScript does it. | ||
Say the `baseUrl` is `../root` and you import `react`. This plugin will use `../root/react` if it exists. If not found, then `react` is resolved normally. | ||
| ||
### include/exclude | ||
The `include` and `exclude` compiler options are respected. | ||
Internally, [globrex](https://github.com/terkelg/globrex) is used for glob matching. Be aware that `**/*` is currently broken (see [here](https://github.com/terkelg/globrex/issues/6)). You should leave `include` undefined if you only set it to `["**/*"]` (which is the default). | ||
| ||
## Donate | ||
@@ -58,0 +72,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
25189
75