-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrollup.config.js
49 lines (46 loc) · 1.02 KB
/
rollup.config.js
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
46
47
48
49
import json from "@rollup/plugin-json";
import { dts } from "rollup-plugin-dts";
import { swc } from "rollup-plugin-swc3";
import commonjs from "@rollup/plugin-commonjs";
import { nodeResolve } from "@rollup/plugin-node-resolve";
const file = (name) => `lib/${name}`;
/**
* @param {import('rollup').RollupOptions} config
* @returns {import('rollup').RollupOptions}
*/
const bundle = (config) => ({
plugins: [nodeResolve(), commonjs(), json(), swc({ minify: true, jsc: {} })],
...config,
});
export default [
bundle({
input: "src/cli.ts",
output: {
file: file`cli.mjs`,
format: "esm",
},
}),
bundle({
input: "src/main.ts",
output: {
file: file`main.mjs`,
format: "esm",
},
}),
bundle({
input: "src/main.ts",
watch: false,
output: {
file: file`main.cjs`,
format: "cjs",
},
}),
bundle({
input: "src/main.ts",
output: {
file: file`types.d.ts`,
format: "es",
},
plugins: [nodeResolve(), commonjs(), json(), dts()],
}),
];