-
-
Notifications
You must be signed in to change notification settings - Fork 56
/
rollup.config.js
42 lines (38 loc) · 1.13 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
const commonJs = require("@rollup/plugin-commonjs");
const resolve = require("@rollup/plugin-node-resolve").default;
const typescript = require("@rollup/plugin-typescript");
const alias = require("@rollup/plugin-alias");
const postcss = require("rollup-plugin-postcss");
const postcssUrl = require("postcss-url");
const HTML_TEMPLATE = ["treemap", "sunburst", "network", "flamegraph"];
/** @type {import('rollup').RollupOptions} */
module.exports = HTML_TEMPLATE.map((templateType) => ({
input: `./src/${templateType}/index.tsx`,
plugins: [
[
typescript({ tsconfig: "./src/tsconfig.json", noEmitOnError: true }),
alias({
entries: [{ find: "picomatch", replacement: "picomatch-browser" }],
}),
resolve({ mainFields: ["module", "main"] }),
commonJs({
ignoreGlobal: true,
include: ["node_modules/**"],
}),
postcss({
extract: true,
plugins: [
postcssUrl({
url: "inline",
}),
],
}),
],
],
output: {
format: "iife",
file: `./dist/lib/${templateType}.js`,
name: "drawChart",
exports: "named",
},
}));