Rush StackShopBlogEvents
Skip to main content

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

Import class

Helpers for resolving and importing Node.js modules.

Signature:

export declare class Import 

Methods

Method

Modifiers

Description

lazy(moduleName, require)

static

Provides a way to improve process startup times by lazy-loading imported modules.

resolveModule(options)

static

This resolves a module path using similar logic as the Node.js require.resolve() API, but supporting extra features such as specifying the base folder.

resolveModuleAsync(options)

static

Async version of Import.resolveModule().

resolvePackage(options)

static

Performs module resolution to determine the folder where a package is installed.

resolvePackageAsync(options)

static

Async version of Import.resolvePackage().