-
Notifications
You must be signed in to change notification settings - Fork 211
/
rollup.config.js
54 lines (44 loc) · 1.57 KB
/
rollup.config.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
const generate = require('videojs-generate-rollup-config');
const dataFiles = require('rollup-plugin-data-files');
const worker = require('rollup-plugin-worker-factory');
// see https://github.com/videojs/videojs-generate-rollup-config
// for options
const shared = {
primedPlugins(defaults) {
defaults = Object.assign(defaults, {
dataFiles: dataFiles({
segments: {include: 'test/segments/**'}
})
});
defaults.worker = worker({plugins: [
defaults.resolve,
defaults.json,
defaults.commonjs,
defaults.babel
]});
return defaults;
},
plugins(defaults) {
defaults.module.splice(2, 0, 'worker');
defaults.browser.splice(2, 0, 'worker');
defaults.test.splice(3, 0, 'worker');
defaults.test.splice(0, 0, 'dataFiles');
// istanbul is only in the list for regular builds and not watch
if (defaults.test.indexOf('istanbul') !== -1) {
defaults.test.splice(defaults.test.indexOf('istanbul'), 1);
}
return defaults;
}
};
const mainBuilds = generate(Object.assign({input: 'lib/index.js', distName: 'mux', exportName: 'muxjs'}, shared)).builds;
const mp4Builds = generate({input: 'lib/mp4/index.js', distName: 'mux-mp4', exportName: 'muxjs'}).builds;
const flvBuilds = generate({input: 'lib/flv/index.js', distName: 'mux-flv', exportName: 'muxjs'}).builds;
const allBuilds = [];
if (mainBuilds.test) {
allBuilds.push(mainBuilds.test);
}
if (mainBuilds.browser) {
allBuilds.push(mainBuilds.browser, mp4Builds.browser, flvBuilds.browser);
}
// export the builds to rollup
export default allBuilds;