Releases: aleclarson/vite-tsconfig-paths
v7.0.0-alpha.1
This release marks a major modernization of vite-tsconfig-paths, moving to the OXC and Rolldown ecosystem for significantly improved performance and a leaner dependency tree.
Special thanks to Ben Snyder (@benpsnyder) for this massive overhaul!
High-Level Changes
- OXC Resolver Integration: Replaced custom path-matching logic with
oxc-resolver. This handlestsconfigpaths natively in Rust, providing a high-performance resolution pipeline. - Rolldown Ready: Added support for Rolldown-compatible
resolveIdhook filters. This allows skipping unnecessary JS-to-Rust boundary calls for relative imports and virtual modules on supported engines (Vite 6.3+, Rollup 4.38+, and Rolldown). - Toolchain Modernization:
- Switched from
tsupto Rolldown for bundling, reducing transitive dependencies by over 100. - Migrated from Prettier to oxfmt (OXC's formatter).
- Introduced oxlint for fast, type-aware linting.
- Uses oxc-transform for native
.d.tsgeneration viaisolatedDeclarations.
- Switched from
- TypeScript 6.0: Upgraded to TypeScript 6.0 RC, including fixes for new strictness requirements and deprecations.
- Performance Wins: Benchmarks show the new implementation is approximately 1.22x faster on the plugin's own test suite and provides measurable wins in real-world AnalogJS targets.
Breaking Changes & Compatibility
- Node.js >= 18 is now required.
- Vite >= 5.0.0 is now the minimum supported version.
.jsonImport Guard: The guard now applies to all resolutions (including those frompaths), requiring explicit extensions for JSON files if they aren't matched by a specific pattern.- Drop-in Replacement: Despite the internal rewrite, all existing test fixtures pass, and the plugin remains a drop-in replacement for most users.
How to try it
This is an alpha release. You can install it using the next tag:
npm install vite-tsconfig-paths@nextv6.1.0
Features
- New
importerFilteroption: Provides fine-grained control over which files should have their imports resolved by this plugin. (Closes #175, #193) - Ignore
.d.tsoverrides: The plugin now ignores resolutions that point to.d.tsfiles, avoiding issues whentsconfigis used for opt-in type overrides. (Closes #179, #180)
Performance
- Hoisted regular expressions out of the hot path in the resolver for better performance.
Internal
- Added
resolvedToDeclarationFileevent to the debug log file.
v6.0.0
Note: No intentional breaking changes. Major version bump due to extensive internal refactoring; downgrade to v5 if needed.
Highlights
- On-demand tsconfig discovery via
projectDiscovery: "lazy", while eager discovery remains the default. - tsconfig/jsconfig files are watched and reloaded automatically in both modes, including during
vite build --watch. - New
logFileoption for per-import resolution traces (passtrueforvite-tsconfig-paths.logor provide a path). - Support for root
/*aliases and other absolute-style imports. - Support for
.astrofiles whenallowJs/looseis enabled.
Fixes
- More reliable tsconfig watching and resolver refreshes: handles lazy discovery edge cases, recreates resolvers after file changes, tolerates missing directories, and copes better with virtual importers.
- Windows path handling now normalizes drive-letter casing to avoid missed matches (#183).
Upgrade notes
- Install the stable release:
pnpm add -D vite-tsconfig-paths. - Opt into lazy discovery or logging when needed:
import tsconfigPaths from 'vite-tsconfig-paths'
export default {
plugins: [
tsconfigPaths({
projectDiscovery: 'lazy',
logFile: true,
}),
],
}- Rooted path patterns such as
"/*": ["src/*"]now resolve the same way tsserver does.
v6.0.0-beta.4
v6.0.0-beta.3
- Added support for
/*path aliases. (#101)
v6.0.0-beta.2
-
Added a new
logFileoption.
PasslogFile: trueand the plugin will create avite-tsconfig-paths.logfile in your working directory.Using
DEBUG=vite-tsconfig-pathsin the past has worked pretty well, but it isn't always the most readable. In v6 and above, this plugin will still have debug logs using this approach, but module resolution will only be logged through the newlogFileoption. The log file will be comprehensive (as in, every import that vite-tsconfig-paths receives will be logged). If an import goes unhandled by this plugin, the reason will be logged. If an import is resolved, the resolved path and the tsconfig path are both logged. In fact, every possible code path (in the context of module resolution) is logged to the log file. -
Universal support for tsconfig reloading.
Whether you're usingprojectDiscovery: "lazy"or eager loading, this plugin should now be able to watch and reload tsconfig files when you make changes to them. This feature hasn't been rigorously tested yet. Please report issues you come across. -
Support for
vite build --watch.
ThebuildStarthook will reset the plugin whenever it's called.
v6.0.0-beta.1
-
Added a new
projectDiscoveryoption.When this option is set to "lazy", tsconfig files will be loaded on-demand. When an import is resolved, the parent directories of the importer are searched for tsconfig files matching the
configNamesarray option (which defaults to["tsconfig.json", "jsconfig.json"]).If using TypeScript’s project references, you can ensure they are discovered by adding the main project to the
projectsarray option of this plugin. Though, this is only necessary if you’re referencing tsconfig files with non-standard names (e.g."tsconfig.src.json"). Setting theprojectsoption will not interfere with lazy project discovery.