Rush StackShopBlogEvents
Skip to main content

Home > @rushstack/node-core-library > RealNodeModulePathResolver

RealNodeModulePathResolver class

This class encapsulates a caching resolver for symlinks in node_modules directories. It assumes that the only symlinks that exist in input paths are those that correspond to npm packages.

Signature:

export declare class RealNodeModulePathResolver 

Remarks

In a repository with a symlinked node_modules installation, some symbolic links need to be mapped for node module resolution to produce correct results. However, calling fs.realpathSync.native on every path, as is commonly done by most resolvers, involves an enormous number of file system operations (for reference, each invocation of fs.realpathSync.native involves a series of fs.readlinkSync calls, up to one for each path segment in the input).

Constructors

Constructor

Modifiers

Description

(constructor)(options)

Constructs a new instance of the RealNodeModulePathResolver class

Properties

Property

Modifiers

Type

Description

realNodeModulePath

readonly

(input: string) => string

Similar in function to fs.realpathSync.native, but assumes the only symlinks present are npm packages.

Methods

Method

Modifiers

Description

clearCache()

Clears the cache of resolved symlinks.