# local-modules-as-globals

> Import local modules globally

Latest version **0.0.3** (published 2016-04-15) · ISC license · 0 weekly downloads

## Install

```sh
npm install local-modules-as-globals
pnpm add local-modules-as-globals
yarn add local-modules-as-globals
bun add local-modules-as-globals
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.0.3 |
| Published | 2016-04-15 |
| First published | 2016-04-15 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | ihermell@student.42.fr |
| Maintainers | yachaka |

## Links

- npm: https://www.npmjs.com/package/local-modules-as-globals
- Repository: https://github.com/yachaka/local-modules-as-globals
- Homepage: https://github.com/yachaka/local-modules-as-globals#readme
- Issues: https://github.com/yachaka/local-modules-as-globals/issues
- npm.io page: https://npm.io/package/local-modules-as-globals

## Recent versions

- 0.0.3 (latest) — 2016-04-15
- 0.0.2 — 2016-04-15
- 0.0.1 — 2016-04-15

## README

# local-modules-as-globals
Import local modules like node_modules/ :fire: 

## Installation
```bash
npm install --save local-modules-as-globals
```

## Usage

1 . Make any local folder in your project global recursively
```js
// At the top of myProject/server/index.js
import 'local-modules-as-globals/register' // Registers __dirname
```

2 . You can then require from any locally-global directory using the `@` prefix.

```js
myProject/
	server/
		index.js
		myModules/
			index.js
				| import 'local-modules-as-globals/register'
				| ...
			moduleA/ /* My moduleA */
			moduleB/ /* My moduleB */
				nestedModule/ /* My nested module */
		far/
			away/
				...
				require('@moduleA') // Will require /myProject/server/myModules/moduleA
				...
		other/
			place/
				...
				require('@moduleB') // Will require /myProject/server/myModules/moduleB
				require('@moduleB/nestedModule') // Will require /myProject/server/myModules/moduleB/nestedModule
				...
```

---
_Source: https://npm.io/package/local-modules-as-globals · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
