-
Notifications
You must be signed in to change notification settings - Fork 1
/
vite.config.js
35 lines (30 loc) · 971 Bytes
/
vite.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
import { resolve, parse, dirname } from 'node:path';
import { fileURLToPath } from 'node:url';
import { defineConfig } from 'vite';
import nunjucks from '@michigandaily/vite-plugin-transform-nunjucks';
import dsv from '@michigandaily/rollup-plugin-dsv';
import { entries, deployment } from './sink.config.json';
const __dirname = dirname(fileURLToPath(import.meta.url));
const graphics = Object.assign(
...Object.keys(entries)
.map((entry) => parse(entry))
.map(({ name, base }) => ({
[name]: resolve(__dirname, `src/graphic/${base}`)
}))
);
// https://vitejs.dev/config/
export default defineConfig({
base: deployment.key.length === 0 ? '/' : `/${deployment.key}/`,
plugins: [nunjucks(), dsv({ include: ['**.csv', '**.tsv', '**.dsv'] })],
root: resolve(__dirname, 'src'),
build: {
outDir: resolve(__dirname, 'dist'),
emptyOutDir: true,
rollupOptions: {
input: {
main: resolve(__dirname, 'src/index.html'),
...graphics
}
}
}
});