-
-
Notifications
You must be signed in to change notification settings - Fork 52
/
Copy pathvite.config.ts
67 lines (64 loc) · 3.11 KB
/
vite.config.ts
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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
import react from '@vitejs/plugin-react'
import { cwd } from 'process'
import { defineConfig } from 'vite'
const installDir = cwd()
console.log(`[VITE] loading vite config`)
// https://vitejs.dev/config/
export default defineConfig({
clearScreen: false,
optimizeDeps: { exclude: ['fsevents', 'esbuild'] },
// https://github.com/vitejs/vite-plugin-react/commit/25fe88a02d3a718b81a3b1290ff4e46bfab427f9
plugins: [react({ jsxImportSource: 'JSOX' })],
build: { emptyOutDir: true, copyPublicDir: false },
server: {
port: 8788,
watch: { ignored: ['**/src/shell/*.js', '**/tsconfig.json', '**/library/**'] },
},
resolve: {
alias: {
// -----------------------------------------------------------------------
mobx: `${installDir}/src/syms/mobx.js`,
nsfwjs: `${installDir}/src/syms/nsfwjs.js`,
'@tensorflow/tfjs': `${installDir}/src/syms/tfjs.js`,
'mime-types': `${installDir}/src/syms/mime-types.js`,
// -----------------------------------------------------------------------
// injected node modules
// 🔶 modifications must be kept in sync between :
// | ./src/shell/build.js
// | ./vite.config.ts
// | ./src/shell/externals.cjs
/* */ assert: `${installDir}/src/syms/assert.js`,
'node:assert': `${installDir}/src/syms/assert.js`,
/* */ url: `${installDir}/src/syms/url.js`,
'node:url': `${installDir}/src/syms/url.js`,
/* */ buffer: `${installDir}/src/syms/buffer.js`,
'node:buffer': `${installDir}/src/syms/buffer.js`,
/* */ child_process: `${installDir}/src/syms/child_process.js`,
'node:child_process': `${installDir}/src/syms/child_process.js`,
/* */ cluster: `${installDir}/src/syms/cluster.js`,
'node:cluster': `${installDir}/src/syms/cluster.js`,
/* */ fs: `${installDir}/src/syms/fs.js`,
'node:fs': `${installDir}/src/syms/fs.js`,
/* */ https: `${installDir}/src/syms/https.js`,
'node:https': `${installDir}/src/syms/https.js`,
/* */ os: `${installDir}/src/syms/os.js`,
'node:os': `${installDir}/src/syms/os.js`,
/* */ path: `${installDir}/src/syms/path.js`,
'node:path': `${installDir}/src/syms/path.js`,
/* */ process: `${installDir}/src/syms/process.js`,
'node:process': `${installDir}/src/syms/process.js`,
/* */ stream: `${installDir}/src/syms/stream.js`,
'node:stream': `${installDir}/src/syms/stream.js`,
/* */ util: `${installDir}/src/syms/util.js`,
'node:util': `${installDir}/src/syms/util.js`,
/* */ zlib: `${installDir}/src/syms/zlib.js`,
'node:zlib': `${installDir}/src/syms/zlib.js`,
/* */ events: `${installDir}/src/syms/events.js`,
'node:events': `${installDir}/src/syms/events.js`,
/* */ async_hooks: `${installDir}/src/syms/async_hooks.js`,
'node:async_hooks': `${installDir}/src/syms/async_hooks.js`,
/* */ crypto: `${installDir}/src/syms/crypto.js`,
'node:crypto': `${installDir}/src/syms/crypto.js`,
},
},
})