import-global
Import a globally installed module
Last updated 3 years ago by sindresorhus .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ npm install import-global 
SYNC missed versions from official npm registry.

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

Current Tags

  • 1.1.1                                ...           latest (3 years ago)

4 Versions

  • 1.1.1                                ...           3 years ago
  • 1.1.0                                ...           3 years ago
  • 1.0.0                                ...           3 years ago
  • 0.1.0                                ...           9 years ago
Maintainers (1)
Downloads
Total 11
Today 0
This Week 0
This Month 4
Last Day 0
Last Week 2
Last Month 4
Dependencies (1)
Dev Dependencies (3)
Dependents (0)
None

© 2010 - cnpmjs.org x YWFE | Home | YWFE