-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathrollup.config.js
More file actions
64 lines (63 loc) · 1.69 KB
/
rollup.config.js
File metadata and controls
64 lines (63 loc) · 1.69 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
import PeerDepsExternalPlugin from "rollup-plugin-peer-deps-external";
import resolve from "@rollup/plugin-node-resolve";
import commonjs from "@rollup/plugin-commonjs";
import dts from "rollup-plugin-dts";
import terser from "@rollup/plugin-terser";
import typescript from "@rollup/plugin-typescript";
import postcss from "rollup-plugin-postcss";
import { visualizer } from "rollup-plugin-visualizer";
export default [
{
input: "src/index.ts",
output: {
dir: "dist",
entryFileNames: "index.js",
format: "cjs",
exports: "named",
// Inline dynamic imports so Rollup doesn't create multiple chunk files
// when bundling dependencies that use dynamic import().
inlineDynamicImports: true,
},
external: ["mermaid"],
plugins: [
PeerDepsExternalPlugin(),
resolve(),
commonjs(),
typescript({ tsconfig: "./tsconfig.json" }),
postcss(),
terser(),
visualizer({
open: true, // This will automatically open the report in your browser
gzipSize: true, // Collect and display gzip sizes
brotliSize: true, // Collect and display brotli sizes
}),
],
},
{
input: "src/index.ts",
output: {
dir: "dist",
entryFileNames: "index.mjs",
format: "esm",
exports: "named",
inlineDynamicImports: true,
},
external: ["mermaid"],
plugins: [
PeerDepsExternalPlugin(),
resolve(),
commonjs(),
typescript({ tsconfig: "./tsconfig.json" }),
postcss(),
terser(),
],
},
{
input: "src/index.ts",
output: {
file: "dist/index.d.ts",
},
plugins: [dts.default()],
external: [/\.css/, "mermaid"],
},
];