forked from carbon-design-system/carbon-components-svelte
-
Notifications
You must be signed in to change notification settings - Fork 0
/
rollup.config.js
48 lines (46 loc) · 1.24 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
import { terser } from "rollup-plugin-terser";
import pkg from "./package.json";
import resolve from "@rollup/plugin-node-resolve";
import commonjs from "@rollup/plugin-commonjs";
import svelte from "rollup-plugin-svelte";
import sveld from "sveld";
export default ["es", "umd"].map((format) => {
const UMD = format === "umd";
return {
input: "src",
output: {
format,
file: UMD ? pkg.main : pkg.module,
name: UMD ? "carbon-components-svelte" : undefined,
globals: {
flatpickr: "flatpickr",
"clipboard-copy": "copy",
},
},
external: Object.keys(pkg.dependencies),
plugins: [
svelte({ emitCss: false }),
resolve(),
commonjs(),
UMD && terser(),
UMD &&
sveld({
glob: true,
markdown: true,
markdownOptions: {
onAppend: (type, document, components) => {
if (type === "h1")
document.append(
"quote",
`${components.size} components exported from ${pkg.name}@${pkg.version}.`
);
},
},
json: true,
jsonOptions: {
outFile: "docs/src/COMPONENT_API.json",
},
}),
],
};
});