-
-
Notifications
You must be signed in to change notification settings - Fork 83
Expand file tree
/
Copy pathrollup.config.ts
More file actions
27 lines (24 loc) · 911 Bytes
/
rollup.config.ts
File metadata and controls
27 lines (24 loc) · 911 Bytes
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
import * as fs from "node:fs";
import type { RollupWatchOptions } from "rollup";
import dts from "./src/index.js";
const pkg = JSON.parse(fs.readFileSync("./package.json", { encoding: "utf-8" }));
const external = ["node:module", "node:path", "node:fs", "node:fs/promises", "typescript", "rollup", "@babel/code-frame", "magic-string", "@jridgewell/remapping", "@jridgewell/sourcemap-codec", "convert-source-map"];
const config: Array<RollupWatchOptions> = [
{
input: "./.build/src/index.js",
output: [
{ file: pkg.exports.import, format: "es" },
{ file: pkg.exports.require, format: "commonjs", exports: "named" },
],
external,
},
{
input: "./.build/src/index.d.ts",
output: [
{ file: pkg.exports.import.replace(/\.mjs$/, ".d.mts") },
{ file: pkg.exports.require.replace(/\.cjs$/, ".d.cts") },
],
plugins: [dts()],
},
];
export default config;