rt-graphic-component/rollup.config.js
2023-12-19 14:20:48 +08:00

37 lines
864 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: "dist",
format: "esm",
preserveModules: true,
},
plugins: [
typescript({
tsconfig: "./tsconfig.json",
compilerOptions: {
declaration: true,
declarationDir: "dist",
},
}),
],
};
module.exports = config;
function getEntryPoints() {
const packageDir = resolve(__dirname, "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;
}