# amd-define-factory-patcher-loader

> AMD define factory patcher loader modeul for webpack

Latest version **1.0.0** (published 2015-03-31) · MPL 2.0 license · 0 weekly downloads

## Install

```sh
npm install amd-define-factory-patcher-loader
pnpm add amd-define-factory-patcher-loader
yarn add amd-define-factory-patcher-loader
bun add amd-define-factory-patcher-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 | 1.0.0 |
| Published | 2015-03-31 |
| First published | 2015-03-31 |
| Weekly downloads | 0 |
| License | MPL 2.0 |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 3 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 7 |
| Author | Alexander O'Mara |
| Maintainers | alexanderomara |

## Links

- npm: https://www.npmjs.com/package/amd-define-factory-patcher-loader
- Repository: https://github.com/AlexanderOMara/amd-define-factory-patcher-loader
- Issues: https://github.com/AlexanderOMara/amd-define-factory-patcher-loader/issues
- npm.io page: https://npm.io/package/amd-define-factory-patcher-loader

## Dependencies (3)

- [esprima](https://npm.io/package/esprima.md) ^2.1.0
- [escodegen](https://npm.io/package/escodegen.md) ^1.6.1
- [estraverse](https://npm.io/package/estraverse.md) ^3.1.0

## Recent versions

- 1.0.0 (latest) — 2015-03-31

## README

# AMD define factory patcher webpack loader

Adds support for non-standard AMD `define` statements with optional `factory` to webpack.


## Overview

According to [the AMD specification](https://github.com/amdjs/amdjs-api/wiki/AMD), the `factory` argument is not optional. Unfortunately, some AMD loaders such as RequireJS differ from the specification. This has resulted in some libraries depending on the non-standard feature, creating problem code like this.

```js
define(['./some-file']);
```

This webpack loader can be used to preprocess those problem files and add an empty `factory` function so that the code can be processed correctly. After being passed through this loader, the problem code will be transformed to look like this.

```js
define(['./some-file'], function() {
});
```


## Installation

`npm install amd-define-factory-patcher-loader`


## Usage

Add a loader directive to match the file(s) you need to patch. The following is an example `webpack.config.js` configuration that will match a file path ending in `path/to/problem/file.js`.

```js

module.exports = {
    entry: './entry',
    output: {
        filename: 'bundle.js'
    },
	module: {
		loaders: [
			{ test: /path\/to\/problem\/file\.js$/, loader: 'amd-define-factory-patcher-loader' }
		]
	}
};
```

To avoid causing issues in spec-compliant libraries, make sure you only target files that have this problem.


## Bugs

If you find a bug or have compatibility issues, please open a ticket under the issues section for this repository.


## License

See [LICENSE.txt](LICENSE.txt)

If this license does not work for you, feel free to contact me.


## Donations

If you find my software useful, please consider making a modest donation on my website at [alexomara.com](http://alexomara.com).

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