# commonjs-require-definition

> Simple common.js `require()` definition.

Latest version **0.6.3** (published 2020-01-14) · MIT license · 0 weekly downloads

## Install

```sh
npm install commonjs-require-definition
pnpm add commonjs-require-definition
yarn add commonjs-require-definition
bun add commonjs-require-definition
```

## 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.6.3 |
| Published | 2020-01-14 |
| First published | 2013-07-20 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 5.5 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 13 |
| Author | Paul Miller |
| Maintainers | paulmillr |
| Keywords | commonjs, module, require, define |

## Links

- npm: https://www.npmjs.com/package/commonjs-require-definition
- Repository: https://github.com/brunch/commonjs-require-definition
- Homepage: https://github.com/brunch/commonjs-require-definition#readme
- Issues: https://github.com/brunch/commonjs-require-definition/issues
- npm.io page: https://npm.io/package/commonjs-require-definition

## Recent versions

- 0.6.3 (latest) — 2020-01-14
- 0.6.2 — 2017-01-20
- 0.6.1 — 2017-01-20
- 0.6.0 — 2017-01-19
- 0.5.0 — 2016-04-21
- 0.4.2 — 2016-03-20
- 0.4.1 — 2016-03-07
- 0.4.0 — 2016-03-04
- 0.3.0 — 2016-02-22
- 0.2.2 — 2015-10-26
- 0.2.1 — 2015-10-18
- 0.2.0 — 2015-04-07
- 0.1.2 — 2013-10-17
- 0.1.1 — 2013-08-06
- 0.1.0 — 2013-07-20

## README

# CommonJS require definition

Simple [CommonJS](http://wiki.commonjs.org/wiki/Modules/1.1) `require()` definition.

## Usage

Include on top of your file and register modules with `require.register(name, fn)`

* `require(name)` — loads registered module and returns its `exports`.
* `require.register(name, fn)` — registers new module. `fn` callback receives `exports, require, module`.
* `require.list()` — lists all registered modules.

```html
<script src="require.js"></script>
<script>
  require.register("module", (exports, require, module) => {
    // Expose `count` externally.
    exports.count = 42;
  });
  console.log(require("module").count);
</script>
```

## License

The MIT License (MIT)

Copyright (c) 2020 Paul Miller https://paulmillr.com/

---
_Source: https://npm.io/package/commonjs-require-definition · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
