-
-
Notifications
You must be signed in to change notification settings - Fork 32
Expand file tree
/
Copy pathrollup.config.ts
More file actions
40 lines (39 loc) · 920 Bytes
/
rollup.config.ts
File metadata and controls
40 lines (39 loc) · 920 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
28
29
30
31
32
33
34
35
36
37
38
39
40
import { defineConfig } from "rollup";
import typescript from "@rollup/plugin-typescript";
import { writeFileSync } from "fs";
export default defineConfig([
{
input: "src/index.ts",
output: [
{ file: "lib/es/index.mjs", format: "module" },
{ file: "lib/cjs/index.js", format: "commonjs" },
],
external: ["https", "tls", "net"],
watch: {
include: "src/**",
},
plugins: [
typescript(),
{
name: "esm-package-json",
writeBundle(options) {
if (options.format === "es") {
writeFileSync("lib/es/package.json", '{\n "type": "module"\n}\n');
}
},
},
],
},
{
input: "src/cli.ts",
output: [
{
file: "lib/cjs/cli.js",
format: "commonjs",
banner: "#!/usr/bin/env node",
},
],
external: ["https", "tls", "net"],
plugins: [typescript()],
},
]);