云盘
志元云盘
备份云盘
Home
/
志元云盘
/
webdav
/
home
/
jcore
/
web
/
front_end
/
node_modules
/
import-global
File
OriginalPic
Thumbnails
CopyAllDownloadUrl
EditTime
Size
index.js
2017-06-26 07:17:06
397 B
license
2017-06-02 03:17:35
1.08 KB
package.json
2017-06-26 07:23:57
686 B
readme.md
2017-06-26 06:22:21
1.39 KB
# import-global [](https://travis-ci.org/sindresorhus/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 ``` ```js const importGlobal = require('import-global'); const catNames = importGlobal('cat-names'); catNames.random(); //=> 'Snuggles' ``` ## API ### importGlobal(moduleId) Throws if the module can't be found. ### importGlobal.silent(moduleId) Returns `null` instead of throwing if the module can't be found. #### moduleId Type: `string` What you would use in `require()`. ## Related - [resolve-global](https://github.com/sindresorhus/resolve-global) - Resolve the path of a globally installed module - [import-from](https://github.com/sindresorhus/import-from) - Import a module from a given path - [resolve-from](https://github.com/sindresorhus/resolve-from) - Resolve the path of a module from a given path - [is-installed-globally](https://github.com/sindresorhus/is-installed-globally) - Check if your package was installed globally - [global-dirs](https://github.com/sindresorhus/global-dirs) - Get the directory of globally installed packages and binaries ## License MIT © [Sindre Sorhus](https://sindresorhus.com)
2025-09-02 16:01:43 Tuesday 216.73.216.107 Runningtime:0.014s Mem:1.48 MB