| hide_title | true |
|---|---|
| custom_edit_url | |
| pagination_prev | |
| pagination_next |
Home > @rushstack/node-core-library > Import > resolvePackage
Performs module resolution to determine the folder where a package is installed.
Signature:
static resolvePackage(options: IImportResolvePackageOptions): string;|
Parameter |
Type |
Description |
|---|---|---|
|
options |
Returns:
string
the absolute path of the package folder. If IImportResolveOptions.includeSystemModules is specified and a system module is found, then its name is returned without any file path.
Suppose example is an NPM package whose entry point is lib/index.js<></>:
// Returns "/path/to/project/node_modules/example"
Import.resolvePackage({ packageName: 'example' });If you need to resolve a module path, use Import.resolveModule() instead:
// Returns "/path/to/project/node_modules/example/lib/index.js"
Import.resolveModule({ modulePath: 'example' });