import-local-file

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

MIT 1 个版本
安装
npm install import-local-file
yarn add import-local-file
pnpm add import-local-file
bun add import-local-file
README

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

版本列表
0.2.0 2017-05-08