import-local

  • Version 3.2.0
  • Published
  • 4.73 kB
  • 2 dependencies
  • MIT license

Install

npm i import-local
yarn add import-local
pnpm add import-local

Overview

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

Index

Functions

Functions

function importLocal

importLocal: (filePath: string) => boolean | undefined | unknown;
  • Let a globally installed package use a locally installed version of itself if available.

    Parameter filePath

    The absolute file path to the main file of the package.

    Example 1

    import importLocal from 'import-local';
    if (importLocal(import.meta.url)) {
    console.log('Using local version of this package');
    } else {
    // Code for both global and local version here…
    }

Package Files (1)

Dependencies (2)

Dev Dependencies (5)

Peer Dependencies (0)

No peer dependencies.

Badge

To add a badge like this onejsDocs.io badgeto your package's README, use the codes available below.

You may also use Shields.io to create a custom badge linking to https://www.jsdocs.io/package/import-local.

  • Markdown
    [![jsDocs.io](https://img.shields.io/badge/jsDocs.io-reference-blue)](https://www.jsdocs.io/package/import-local)
  • HTML
    <a href="https://www.jsdocs.io/package/import-local"><img src="https://img.shields.io/badge/jsDocs.io-reference-blue" alt="jsDocs.io"></a>