-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrollup.config.mjs
45 lines (41 loc) · 994 Bytes
/
rollup.config.mjs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
import { readFileSync } from "node:fs";
// rollup.config.mjs
import json from "@rollup/plugin-json";
import { dts } from "rollup-plugin-dts";
import esbuild from "rollup-plugin-esbuild";
import { nodeExternals } from "rollup-plugin-node-externals";
const pkg = JSON.parse(readFileSync("./package.json", "utf-8"));
const banner = `/**
* Name: ${pkg.name}
* Version: ${pkg.version}
* Author: ${pkg.author}
* Homepage: ${pkg.homepage}
* License ${pkg.license} © 2023-Present
*/\n`;
/**
* @type {import('rollup').RollupOptions}
*/
const rollupConfig = [
{
input: "./src/index.ts",
plugins: [json(), esbuild(), nodeExternals()],
output: [
{
file: "./dist/index.cjs",
format: "cjs",
banner,
},
{
file: "./dist/index.mjs",
format: "esm",
banner,
},
],
},
{
input: "./src/index.ts",
plugins: [json(), dts(), nodeExternals()],
output: [{ file: "./dist/index.d.cts" }, { file: "./dist/index.d.mts" }],
},
];
export default rollupConfig;