rt-graphic-component/rollup.config.cjs
2023-12-25 13:54:11 +08:00

36 lines
879 B
JavaScript

const { resolve } = require("path");
const { readdirSync } = require("fs");
const typescript = require("@rollup/plugin-typescript");
/**
* @type {import('rollup').RollupOptions}
*/
const config = {
external: ["jl-graphic"],
input: getEntryPoints(),
output: {
dir: "components",
format: "esm",
preserveModules: true,
},
plugins: [
typescript({
tsconfig: "./tsconfig.json",
compilerOptions: {
declaration: true,
declarationDir: "components",
},
}),
],
};
module.exports = config;
function getEntryPoints() {
const packageDir = resolve(__dirname, "src/packages");
const entryPoints = readdirSync(packageDir, { withFileTypes: true })
.filter((dirent) => dirent.isDirectory())
.map((dirent) => resolve(packageDir, dirent.name, `${dirent.name}.ts`));
console.log(entryPoints);
return entryPoints;
}