1 | # rollup-plugin-multi-entry
|
2 |
|
3 | Use multiple entry points in your [rollup](https://github.com/rollup/rollup)
|
4 | bundle. This is particularly useful for tests, but can also be used to package
|
5 | a library. The exports from all the entry points will be combined, e.g.
|
6 |
|
7 | ```js
|
8 | // a.js
|
9 | export const a = 1;
|
10 |
|
11 | // b.js
|
12 | export const b = 2;
|
13 |
|
14 | // c.js
|
15 | export const c = 3;
|
16 | ```
|
17 |
|
18 | Using 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 |
|
29 | This plugin requires at least v0.25.4 of rollup. In `rollup.config.js`:
|
30 |
|
31 | ```js
|
32 | import multiEntry from 'rollup-plugin-multi-entry';
|
33 |
|
34 | export default {
|
35 | input: 'test/**/*.js',
|
36 | plugins: [multiEntry()]
|
37 | };
|
38 | ```
|
39 |
|
40 | The `entry` above is the simplest form which simply takes a glob string. If you
|
41 | wish, you may pass an array of glob strings or, for finer control, an object
|
42 | with `include` and `exclude` properties each taking an array of glob strings,
|
43 | e.g.
|
44 |
|
45 | ```js
|
46 | // The usual rollup entry configuration works.
|
47 | export default {
|
48 | input: 'just/one/file.js',
|
49 | plugins: [multiEntry()]
|
50 | // ...
|
51 | };
|
52 |
|
53 | // As does a glob of files.
|
54 | export default {
|
55 | input: 'a/glob/of/files/**/*.js',
|
56 | plugins: [multiEntry()]
|
57 | // ...
|
58 | };
|
59 |
|
60 | // Or an array of files and globs.
|
61 | export 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.
|
68 | export 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 |
|
78 | Sometimes you may not want to export anything from the rolled-up bundle. In
|
79 | such cases, use the `exports: false` option like so:
|
80 |
|
81 | ```js
|
82 | export default {
|
83 | input: 'src/*.js',
|
84 | plugins: [multiEntry({ exports: false })]
|
85 | };
|
86 | ```
|
87 |
|
88 | ## License
|
89 |
|
90 | MIT
|