1.1.1 • Published 3 months ago

import-global v1.1.1

Weekly downloads
104,424
License
MIT
Repository
github
Last release
3 months ago

import-global

Import a globally installed module

Please don't use this unless absolutely necessary. Local dependencies should be preferred.

Install

npm install import-global

Usage

npm install --global cat-names
import {importGlobal} from 'import-global';

const {default: catNames} = await importGlobal('cat-names');

catNames.random();
//=> 'Snuggles'

API

importGlobal(moduleName)

Throws if the module cannot be found.

importGlobalSilent(moduleName)

Returns undefined instead of throwing if the module cannot be found.

moduleName

Type: string

What you would use in import().

Related

1.1.1

3 months ago

1.1.0

6 months ago

1.0.0

6 months ago

0.1.0

7 years ago