Socket
Socket
Sign inDemoInstall

vite-tsconfig-paths

Package Overview
Dependencies
Maintainers
1
Versions
69
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

vite-tsconfig-paths - npm Package Compare versions

Comparing version 3.2.0 to 3.2.1

2

package.json
{
"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 @@

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc