rollup.config.js 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. import { defineConfig } from "rollup";
  2. import { terser } from "rollup-plugin-terser";
  3. import resolve from "rollup-plugin-node-resolve";
  4. import progress from "rollup-plugin-progress";
  5. import commonjs from "@rollup/plugin-commonjs";
  6. import copy from "rollup-plugin-copy";
  7. import deletePlugin from "rollup-plugin-delete";
  8. import OMT from "@surma/rollup-plugin-off-main-thread";
  9. import url from "@rollup/plugin-url";
  10. export default defineConfig({
  11. external: [".npmrc", "package.json"],
  12. input: ["./src/omnimatrix-video-player.js"],
  13. output: [
  14. {
  15. dir: "./example/html-example/lib/omnimatrix-video-player",
  16. format: "esm",
  17. entryFileNames: (chunkInfo) => {
  18. if (/^omnimatrix-video-player/i.test(chunkInfo.name)) {
  19. return "[name].js";
  20. } else {
  21. return "lib/[hash].js";
  22. }
  23. },
  24. chunkFileNames: "lib/[hash].js",
  25. plugins: [terser()],
  26. },
  27. // {
  28. // dir: "dist/min",
  29. // format: "es",
  30. // entryFileNames: (chunkInfo) => {
  31. // if (/^omnimatrix-video-player/i.test(chunkInfo.name)) {
  32. // return "[name].min.js";
  33. // } else {
  34. // return "lib/[hash].js";
  35. // }
  36. // },
  37. // chunkFileNames: "lib/[hash].js",
  38. // plugins: [terser()],
  39. // },
  40. ],
  41. plugins: [
  42. deletePlugin({
  43. targets: ["./example/html-example/lib/omnimatrix-video-player"],
  44. }),
  45. progress(),
  46. resolve(),
  47. commonjs(),
  48. url(),
  49. copy({
  50. targets: [
  51. {
  52. src: "src/core",
  53. dest: "./example/html-example/lib/omnimatrix-video-player/lib",
  54. },
  55. {
  56. src: "src/ffmpeg",
  57. dest: "./example/html-example/lib/omnimatrix-video-player/lib",
  58. },
  59. {
  60. src: "src/.npmrc",
  61. dest: "./example/html-example/lib/omnimatrix-video-player",
  62. },
  63. {
  64. src: "src/package.json",
  65. dest: "./example/html-example/lib/omnimatrix-video-player",
  66. },
  67. {
  68. src: "src/README.md",
  69. dest: "./example/html-example/lib/omnimatrix-video-player",
  70. },
  71. // { src: "src/core", dest: "dist/min/lib" },
  72. // { src: "src/ffmpeg", dest: "dist/min/lib" },
  73. ],
  74. }),
  75. OMT({}),
  76. ],
  77. });