UNPKG

1.09 kBJavaScriptView Raw
1import commonjs from 'rollup-plugin-commonjs';
2import json from 'rollup-plugin-json';
3import resolve from 'rollup-plugin-node-resolve';
4
5const 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');
9const banner = `/**\n${bannerLines}\n */`;
10
11const missing = `export default () => console.log('You must import the full version of Bottleneck in order to use this feature.');`;
12const exclude = [
13 'RedisDatastore.js',
14 'RedisConnection.js',
15 'IORedisConnection.js',
16 'Scripts.js'
17];
18
19export 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};