-
-
Notifications
You must be signed in to change notification settings - Fork 195
/
Copy pathvite.config.mts
47 lines (45 loc) · 1.26 KB
/
vite.config.mts
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
import path from 'node:path';
import fs from 'node:fs/promises';
import { fileURLToPath } from 'node:url';
import { defineConfig } from 'vite';
import react from '@vitejs/plugin-react';
import { lingui } from '@lingui/vite-plugin';
import tailwindcss from '@tailwindcss/vite';
import { chrome } from './scripts/electron-vendors.mjs';
import pkg from './package.json';
const currentFolderPath = fileURLToPath(new URL('.', import.meta.url));
const srcFolderPath = path.resolve(currentFolderPath, 'src');
const rendererFolderPath = path.resolve(srcFolderPath, 'ui');
export default defineConfig({
root: process.env.VITEST ? '' : rendererFolderPath,
resolve: {
alias: {
csdm: srcFolderPath,
},
},
base: '',
build: {
outDir: path.resolve(currentFolderPath, 'out'),
target: `chrome${chrome}`,
sourcemap: true,
},
define: {
APP_VERSION: `"${pkg.version}"`,
},
plugins: [
react({
babel: {
plugins: ['macros'],
},
}),
lingui(),
tailwindcss(),
{
name: 'write-changelog-file',
async closeBundle() {
// Write a dummy changelog file that will be used to determine if the changelog dialog should be shown.
await fs.writeFile('./static/changelog', '', 'utf-8');
},
},
],
});