source: imaps-frontend/node_modules/import-local/readme.md

main
Last change on this file was 79a0317, checked in by stefan toskovski <stefantoska84@…>, 4 days ago

F4 Finalna Verzija

  • Property mode set to 100644
File size: 671 bytes
RevLine 
[79a0317]1# import-local
2
3> Let a globally installed package use a locally installed version of itself if available
4
5Useful 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, [AVA](https://avajs.dev) and [XO](https://github.com/xojs/xo) uses this method.
6
7## Install
8
9```sh
10npm install import-local
11```
12
13## Usage
14
15```js
16import importLocal from 'import-local';
17
18if (importLocal(import.meta.url)) {
19 console.log('Using local version of this package');
20} else {
21 // Code for both global and local version here…
22}
23```
24
25You can also pass in `__filename` when used in a CommonJS context.
Note: See TracBrowser for help on using the repository browser.