-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrollup.config.mjs
More file actions
executable file
·65 lines (63 loc) · 1.21 KB
/
rollup.config.mjs
File metadata and controls
executable file
·65 lines (63 loc) · 1.21 KB
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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
import json from '@rollup/plugin-json';
import terser from "@rollup/plugin-terser";
import resolve from '@rollup/plugin-node-resolve';
import { readFileSync } from "fs";
const
pkg = JSON.parse(readFileSync(new URL("./package.json", import.meta.url), "utf8")),
globals={ "jsonstat-toolkit": "JSONstat" },
external=["jsonstat-toolkit"],
preamble=`// ${pkg.name} v${pkg.version} Copyright ${(new Date).getFullYear()} ${pkg.author.name} ${pkg.homepage}`,
plugins=[
json(),
terser({
output: { preamble }
})
]
;
export default [
{
input: "./src/index.js",
external,
output: [
{
name: "JSONstatUtils",
file: pkg.unpkg,
format: "iife",
globals
}
],
plugins: [
...plugins
]
},
{
input: "./src/index.js",
external,
output: [
{
file: pkg.module,
format: "esm",
globals
},
{
file: pkg.main,
format: "cjs",
globals
},
],
plugins: [
...plugins
]
},
{
input: "./src/index.js",
output: {
file: "import.mjs",
format: "esm",
},
plugins: [
resolve({mainFields: ["browser"]}),
...plugins
]
}
]