snapkitty
hardware
erlang
File size: 1,194 Bytes
b8a03fa
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
import { cp, mkdir } from 'node:fs/promises';
import { resolve } from 'node:path';
import { fileURLToPath } from 'node:url';

import { defineConfig } from 'vite';

const projectRoot = fileURLToPath(new URL('.', import.meta.url));

export default defineConfig({
  base: './',
  build: {
    emptyOutDir: true,
    outDir: '_site',
    chunkSizeWarningLimit: 900,
    rollupOptions: {
      input: {
        app: resolve(projectRoot, 'index.html'),
        desktop: resolve(projectRoot, 'desktop', 'index.html'),
      },
    },
    sourcemap: true,
    target: 'es2022',
  },
  plugins: [{
    name: 'preserve-dashboard-artifacts',
    apply: 'build',
    async closeBundle(): Promise<void> {
      const source = resolve(projectRoot, 'public');
      const destination = resolve(projectRoot, '_site', 'public');
      await mkdir(destination, { recursive: true });
      await cp(source, destination, { recursive: true, force: true });
      await cp(resolve(projectRoot, 'orchestrator.html'), resolve(projectRoot, '_site', 'orchestrator.html'), { force: true });
    },
  }],
  server: {
    host: '127.0.0.1',
    port: 4173,
  },
  preview: {
    host: '127.0.0.1',
    port: 4173,
  },
});