# mock-loader

> Mock loader for webpack

Latest version **2.0.0** (published 2017-05-26) · MIT license · 0 weekly downloads

## Install

```sh
npm install mock-loader
pnpm add mock-loader
yarn add mock-loader
bun add mock-loader
```

## Health

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

Positive: no vulnerabilities.

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

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 2.0.0 |
| Published | 2017-05-26 |
| First published | 2015-12-28 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 1 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 3 |
| Author | Jelle Versele |
| Maintainers | vejersele |

## Links

- npm: https://www.npmjs.com/package/mock-loader
- Repository: https://github.com/vejersele/mock-loader
- Homepage: https://github.com/vejersele/mock-loader#readme
- Issues: https://github.com/vejersele/mock-loader/issues
- npm.io page: https://npm.io/package/mock-loader

## Dependencies (1)

- [babel-core](https://npm.io/package/babel-core.md) ^6.24.1

## Recent versions

- 2.0.0 (latest) — 2017-05-26
- 1.0.0 — 2017-04-04
- 0.1.0 — 2015-12-28

## README

# Mock loader (WIP)

Webpack mock loader for AMD modules only.

Inspired by [proxy-loader](https://github.com/c-dante/proxy-loader) and 
[inject-loader](https://github.com/plasticine/inject-loader) but since they 
both lack descent support for AMD modules, this module was created.

## Usage

Once a module is loaded with the mock loader an injector function will be 
returned instead of the original module. This function can be used to mock the
original dependencies of the loaded module. The injector accepts an object with 
dependency paths as keys and mock objects as values. If a given dependency is omitted
the original dependency will be loaded automatically.

```javascript
define(
[
    'mock!./myModule'
],
function (
    myModuleInjector
) {

    var myMock = {
        method: function () {
            return true;
        }
    };

    var myModule = myModuleInjector({
        'path/to/original/dep': myMock
    });
});
```

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