UNPKG

1.91 kBMarkdownView Raw
1# rollup-plugin-multi-entry
2
3Use multiple entry points in your [rollup](https://github.com/rollup/rollup)
4bundle. This is particularly useful for tests, but can also be used to package
5a library. The exports from all the entry points will be combined, e.g.
6
7```js
8// a.js
9export const a = 1;
10
11// b.js
12export const b = 2;
13
14// c.js
15export const c = 3;
16```
17
18Using all three files above as entry points will yield a bundle with exports for
19`a`, `b`, and `c`.
20
21## Install
22
23```
24$ npm install [--save-dev] rollup-plugin-multi-entry
25```
26
27## Usage
28
29This plugin requires at least v0.25.4 of rollup. In `rollup.config.js`:
30
31```js
32import multiEntry from 'rollup-plugin-multi-entry';
33
34export default {
35 input: 'test/**/*.js',
36 plugins: [multiEntry()]
37};
38```
39
40The `entry` above is the simplest form which simply takes a glob string. If you
41wish, you may pass an array of glob strings or, for finer control, an object
42with `include` and `exclude` properties each taking an array of glob strings,
43e.g.
44
45```js
46// The usual rollup entry configuration works.
47export default {
48 input: 'just/one/file.js',
49 plugins: [multiEntry()]
50 // ...
51};
52
53// As does a glob of files.
54export default {
55 input: 'a/glob/of/files/**/*.js',
56 plugins: [multiEntry()]
57 // ...
58};
59
60// Or an array of files and globs.
61export default {
62 input: ['an/array.js', 'of/files.js', 'or/globs/**/*.js'],
63 plugins: [multiEntry()]
64 // ...
65};
66
67// For maximum control, arrays of globs to include and exclude.
68export default {
69 input: {
70 include: ['files.js', 'and/globs/**/*.js', 'to/include.js'],
71 exclude: ['those/files.js', 'and/globs/*.to.be.excluded.js']
72 },
73 plugins: [multiEntry()]
74 // ...
75};
76```
77
78Sometimes you may not want to export anything from the rolled-up bundle. In
79such cases, use the `exports: false` option like so:
80
81```js
82export default {
83 input: 'src/*.js',
84 plugins: [multiEntry({ exports: false })]
85};
86```
87
88## License
89
90MIT