aboutsummaryrefslogtreecommitdiff
path: root/bundle/vite.config.js
blob: cf173c1e20bc4ec26ab1bb2514b2fc9622f610c9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19

import { defineConfig } from 'vite';
import commonjs from '@rollup/plugin-commonjs';
import { readFileSync } from 'node:fs';
import configuration from './src-tauri/tauri.conf.json';

export default defineConfig({
	plugins: [commonjs({ include: /plugin\/src\// }), {
		name: 'bundled-notices',
		generateBundle() {
			// Frontend assets are embedded in the portable Windows executable too.
			for (const [source, fileName] of Object.entries(configuration.bundle.resources)) {
				this.emitFile({ type: 'asset', fileName, source: readFileSync(new URL(`./src-tauri/${source}`, import.meta.url)) });
			}
		}
	}],
	server: { port: 1420, strictPort: true },
	clearScreen: false,
	build: { target: 'es2022' }
});