forked from iden3/ffjavascript
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathrollup.config.mjs
46 lines (43 loc) · 915 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
46
import fs from "fs";
import terser from "@rollup/plugin-terser";
function firstLetterUpperCase(str) {
return str.charAt(0).toUpperCase() + str.slice(1);
}
const pkg = JSON.parse(fs.readFileSync("./package.json"));
export default [
{
input: "main.js",
output: [
{
file: "build/main.cjs.js",
format: "cjs",
},
{
file: "build/main.esm.js",
format: "esm",
},
{
dir: "build/lib.cjs",
format: "cjs",
preserveModules: true,
},
{
dir: "build/lib.esm",
format: "esm",
preserveModules: true,
},
],
external: [...Object.keys(pkg.dependencies || {})],
},
{
input: "main.js",
output: [
{
file: "build/main.umd.min.js",
format: "umd",
name: firstLetterUpperCase(pkg.name.split("/")[1]),
},
],
plugins: [terser()],
},
];