import { defineConfig } from "rollup"; import { terser } from "rollup-plugin-terser"; import resolve from "rollup-plugin-node-resolve"; import progress from "rollup-plugin-progress"; import commonjs from "@rollup/plugin-commonjs"; import copy from "rollup-plugin-copy"; import deletePlugin from "rollup-plugin-delete"; import OMT from "@surma/rollup-plugin-off-main-thread"; import url from "@rollup/plugin-url"; export default defineConfig({ external: [".npmrc", "package.json"], input: ["./src/omnimatrix-video-player.js"], output: [ { dir: "./example/html-example/lib/omnimatrix-video-player", format: "esm", entryFileNames: (chunkInfo) => { if (/^omnimatrix-video-player/i.test(chunkInfo.name)) { return "[name].js"; } else { return "lib/[hash].js"; } }, chunkFileNames: "lib/[hash].js", plugins: [terser()], }, // { // dir: "dist/min", // format: "es", // entryFileNames: (chunkInfo) => { // if (/^omnimatrix-video-player/i.test(chunkInfo.name)) { // return "[name].min.js"; // } else { // return "lib/[hash].js"; // } // }, // chunkFileNames: "lib/[hash].js", // plugins: [terser()], // }, ], plugins: [ deletePlugin({ targets: ["./example/html-example/lib/omnimatrix-video-player"], }), progress(), resolve(), commonjs(), url(), copy({ targets: [ { src: "src/core", dest: "./example/html-example/lib/omnimatrix-video-player/lib", }, { src: "src/ffmpeg", dest: "./example/html-example/lib/omnimatrix-video-player/lib", }, { src: "src/.npmrc", dest: "./example/html-example/lib/omnimatrix-video-player", }, { src: "src/package.json", dest: "./example/html-example/lib/omnimatrix-video-player", }, { src: "src/README.md", dest: "./example/html-example/lib/omnimatrix-video-player", }, // { src: "src/core", dest: "dist/min/lib" }, // { src: "src/ffmpeg", dest: "dist/min/lib" }, ], }), OMT({}), ], });