1 | import commonjs from 'rollup-plugin-commonjs';
|
2 | import json from 'rollup-plugin-json';
|
3 | import resolve from 'rollup-plugin-node-resolve';
|
4 |
|
5 | const bannerLines = [
|
6 | 'This file contains the Bottleneck library (MIT), compiled to ES2017, and without Clustering support.',
|
7 | 'https://github.com/SGrondin/bottleneck',
|
8 | ].map(x => ` * ${x}`).join('\n');
|
9 | const banner = `/**\n${bannerLines}\n */`;
|
10 |
|
11 | const missing = `export default () => console.log('You must import the full version of Bottleneck in order to use this feature.');`;
|
12 | const exclude = [
|
13 | 'RedisDatastore.js',
|
14 | 'RedisConnection.js',
|
15 | 'IORedisConnection.js',
|
16 | 'Scripts.js'
|
17 | ];
|
18 |
|
19 | export default {
|
20 | input: 'lib/index.js',
|
21 | output: {
|
22 | name: 'Bottleneck',
|
23 | file: 'light.js',
|
24 | sourcemap: false,
|
25 | globals: {},
|
26 | format: 'umd',
|
27 | banner
|
28 | },
|
29 | external: [],
|
30 | plugins: [
|
31 | json(),
|
32 | {
|
33 | load: id => {
|
34 | const chunks = id.split('/');
|
35 | const file = chunks[chunks.length - 1];
|
36 | if (exclude.indexOf(file) >= 0) {
|
37 | return missing
|
38 | }
|
39 | }
|
40 | },
|
41 | resolve(),
|
42 | commonjs()
|
43 | ]
|
44 | };
|