-
Notifications
You must be signed in to change notification settings - Fork 24
/
Copy pathvite.config.mjs
55 lines (51 loc) · 1.08 KB
/
vite.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
47
48
49
50
51
52
53
54
55
import { defineConfig } from 'vite';
import virtualHtmlTemplate from 'vite-plugin-virtual-html-template';
const chunks = [
'index',
'axes',
'text-labels',
'connected-points-by-segments',
'connected-points',
'dynamic-opacity',
'embedded',
'performance-mode',
'size-encoding',
'texture-background',
'transition',
'multiple-instances',
'annotations',
];
const pages = Object.fromEntries(
chunks.map((chunk) => [
chunk,
{ template: 'public/index.html', entry: `example/${chunk}.js` },
])
);
const manualChunks = (id) => {
if (id.includes('node_modules')) {
if (id.includes('apache-arrow')) {
return 'apache-arrow';
}
if (id.includes('d3')) {
return 'd3';
}
return 'vendor';
}
return undefined;
};
export default defineConfig({
base: './',
plugins: [virtualHtmlTemplate({ pages })],
build: {
outDir: 'docs',
rollupOptions: {
input: Object.fromEntries(
chunks.map((chunk) => [chunk, `${chunk}.html`])
),
output: { manualChunks },
},
},
optimizeDeps: {
exclude: ['regl-line'],
},
});