1. import-local-file
Let a globally installed package use a locally installed version of itself if available
import-local-file
Package: import-local-file
Created by: sindresorhus
Last modified: Sun, 19 Jun 2022 00:54:06 GMT
Version: 0.2.0
License: MIT
Downloads: 2,907
Repository: https://github.com/sindresorhus/import-local

Install

npm install import-local-file
yarn add import-local-file

import-local-file

NPM version NPM downloads CircleCI donate

Let a globally installed package use a locally installed version of itself if available

Useful for CLI tools that want to defer to the user's locally installed version when available, but still work if it's not installed locally. For example, Poi uses this method.

Install

$ npm install --save import-local-file

Usage

 const importLocalFile = require('import-local');

const localFile = importLocalFile(__filename)
if (localFile) {
	console.log('Using local version of this package');
	require(localFile);
} else {
	// Code for both global and local version here…
}

License

MIT © EGOIST forked from Sindre Sorhus

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