1. import-global
Import a globally installed module
import-global
Package: import-global
Created by: sindresorhus
Last modified: Wed, 10 Jan 2024 10:06:12 GMT
Version: 1.1.1
License: MIT
Downloads: 554,142
Repository: https://github.com/sindresorhus/import-global

Install

npm install import-global
yarn add import-global

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 POST

Enhancing Vue.js Development: Harnessing the Potential of Vue-Loader

Enhancing Vue.js Development: Harnessing the Potential of Vue-Loader

Simplify Data Validation in Vue.js: A Step-by-Step Guide to Using Regex

Simplify Data Validation in Vue.js: A Step-by-Step Guide to Using Regex

Troubleshooting Made Easy: Common Issues and Solutions with vue-loader Without vue-cli

Troubleshooting Made Easy: Common Issues and Solutions with vue-loader Without vue-cli

Optimizing Webpack 4 with Vue CLI 3: Disabling the Cache-Loader

Optimizing Webpack 4 with Vue CLI 3: Disabling the Cache-Loader

Step-by-Step Guide: How to Add a Function to Your Vuex Plugin

Step-by-Step Guide: How to Add a Function to Your Vuex Plugin