-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathvite.config.mjs
51 lines (48 loc) · 1022 Bytes
/
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
import {join} from 'node:path';
const PACKAGE_ROOT = __dirname;
/**
* @type {import('vite').UserConfig}
* @see https://vitejs.dev/config/
*/
const config = {
mode: process.env.MODE,
root: PACKAGE_ROOT,
resolve: {
alias: {
'/@/': join(PACKAGE_ROOT, 'src'),
'fs': 'original-fs', // 把 fs 替换为 original-fs 否则无法操作 asar。
},
},
build: {
ssr: true,
sourcemap: false,
target: 'node18',
outDir: 'dist',
minify: false,
rollupOptions: {
input: ['src/index.ts'],
output: [
{
format: 'esm',
entryFileNames: '[name].mjs',
},
{
format: 'cjs',
entryFileNames: '[name].cjs',
}
],
external: [
'electron',
'original-fs',
// 'node:util',
// 'node:https',
// 'node:path',
// 'node:process',
// 'node:child_process',
// 'node:stream',
// 'node:zlib'
],
},
}
};
export default config;