UnRS Resolver is a high-performance, Rust-ported module resolution library for Node.js environments, currently at version 1.11.1. It provides a robust implementation of both ECMAScript Module (ESM) and CommonJS resolution algorithms, closely aligning with webpack's enhanced-resolve. Key differentiators include built-in `tsconfig-paths-webpack-plugin` support for handling `tsconfig.extends`, `compilerOptions.paths`, and `references`, along with specific enhancements for Yarn Plug'n'Play (PnP) resolution. The library also features an in-memory file system via its `FileSystem` trait and `tracing` instrumentation. It addresses known resolution issues encountered by tools like `eslint-plugin-import-x` and `eslint-import-resolver-typescript`, ensuring greater compatibility and correctness in complex monorepos and build setups. The project maintains an active release cadence, regularly syncing with upstream `oxc-resolver` for improvements and bug fixes.
npm install unrs-resolverVerified import paths — ran on the pinned version, not inferred.
Demonstrates synchronous module resolution using a configured `ResolverFactory` instance. It shows how to resolve Node.js modules, custom aliased paths, and relative paths within a project, including basic error handling.
Upgrade `unrs-resolver` to version `1.11.0` or higher to benefit from improved Yarn PnP manifest handling and error reporting.
Upgrade `unrs-resolver` to version `1.10.0` or higher, which includes fixes for resolving abnormal relative paths and ensures correct aliasing behavior.
Ensure your system has the necessary C++ build tools installed (e.g., Visual Studio Build Tools on Windows, `build-essential` on Linux, Xcode command-line tools on macOS). Refer to `napi-rs` and `unrs-resolver` documentation for specific platform requirements and known compatibility issues (e.g., on ARM architectures like Raspberry Pi).
Ensure Yarn PnP is correctly initialized in your project. If the issue persists, upgrade `unrs-resolver` to `v1.11.0` or newer, which includes fixes for PnP manifest handling.
Double-check the `alias` and `typescript.configFilePath` options in your `ResolverFactory` configuration. If using absolute path aliases, ensure `unrs-resolver` is `v1.10.0` or higher to benefit from relevant bug fixes.
Install the required C++ build tools for your operating system (e.g., `sudo apt-get install build-essential` on Debian/Ubuntu, `xcode-select --install` on macOS, Visual Studio Build Tools with C++ desktop development workload on Windows). Consult the `napi-rs` documentation for detailed platform-specific setup instructions.