rollup.config.js 1.6 KB

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