# multidefine-library-webpack-plugin

> This plugin allow webpack 2 to bundle your code to a named amd library with multiple entries in a same asset.

Latest version **0.3.2** (published 2017-03-30) · MIT license · 0 weekly downloads

## Install

```sh
npm install multidefine-library-webpack-plugin
pnpm add multidefine-library-webpack-plugin
yarn add multidefine-library-webpack-plugin
bun add multidefine-library-webpack-plugin
```

## 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.3.2 |
| Published | 2017-03-30 |
| First published | 2017-02-04 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Node | >=6.9.4 |
| Dependencies | 0 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 2 |
| Author | Thomas Cholley |
| Maintainers | waidd |
| Keywords | amd, webpack, webpack-plugin |

## Links

- npm: https://www.npmjs.com/package/multidefine-library-webpack-plugin
- Repository: https://github.com/Waidd/multidefine-library-webpack-plugin
- Homepage: https://github.com/Waidd/multidefine-library-webpack-plugin#readme
- Issues: https://github.com/Waidd/multidefine-library-webpack-plugin/issues
- npm.io page: https://npm.io/package/multidefine-library-webpack-plugin

## Alternatives

- [@mdxeditor/editor](https://npm.io/package/@mdxeditor/editor.md) — 962.4K weekly downloads
- [mmdb-lib](https://npm.io/package/mmdb-lib.md) — 680.9K weekly downloads
- [playcanvas](https://npm.io/package/playcanvas.md) — 36.2K weekly downloads
- [@glw907/cairn-cms](https://npm.io/package/@glw907/cairn-cms.md) — 967 weekly downloads
- [markdown-to-confluence](https://npm.io/package/markdown-to-confluence.md) — 103 weekly downloads

## Recent versions

- 0.3.2 (latest) — 2017-03-30
- 0.3.1 — 2017-03-23
- 0.3.0 — 2017-03-21
- 0.1.0 — 2017-02-04

## README

# Multidefine Library Webpack Plugin

This <s>hack</s> plugin allow webpack 2 to bundle your code to a named amd library with multiple entries in a same asset.

## Requirements

- node >= 6.9.4
- webpack >= 2.2.0

## Installation

```bash
npm install multidefine-library-webpack-plugin --save
```

Or add it to your package.json

## Usage

### Phase 1: config

Add the plugin in your `webpack.config.js`:

```javascript
'use strict';

const MultidefineLibraryWebpackPlugin = require('multidefine-library-webpack-plugin');

module.exports = {
  entry: ['a.js', 'b.js'],
  output: {
    path: './build',
    filename: '[name].js'
  },
  plugins: [
    new MultidefineLibraryWebpackPlugin([{
      path: 'a.js',
      name: 'A'
    }, {
      path: 'b.js',
      name: 'B'
    }])
  ]
};
```

###Phase 2:

???

###Phase 3: profit

Now, you can requirejs your modules:

```javascript
require(['A', 'B'], function (A, B) {
  // A and B are available !
});
```

This plugin support `amd`, `umd` and `commonjs` source module.

## Configuration

### First parameter: modules to expose

The plugin take an array of objects as first parameter. Each object will represent an entry point of your asset:
```javascript
[{
  path: "a.js", // path to the file that you want to make requireable
  name: "A", // Define name of the module
  [aliases: ["alias1", "alias2"]] // alternate deprecated names exposed for this module
  [deprecated: true/false] // If deprecated, a global method "deprecated" is called is this module is used
}]
```

This plugin can also take an object as parameter. Each key will represent an entry point of your asset:
```javascript
{
  "a.js": { // path to the file that you want to make requireable
    name: "A", // Define name of the module
    [aliases: ["alias1", "alias2"]] // alternate deprecated names exposed for this module
    [deprecated: true/false] // If deprecated, a global method "deprecated" is called is this module is used
  }
}
```

### Second parameter: options

The plugin take an options object as second parameter.
```javascript
    new MultidefineLibraryWebpackPlugin(modulesToExpose, {
      deprecationMethodName: 'deprecated' // global method name to call to notify deprecated usage
    })

```

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