forked from surrealdb/surrealist
-
Notifications
You must be signed in to change notification settings - Fork 0
/
vite.config.ts
68 lines (66 loc) · 1.6 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
68
import react from '@vitejs/plugin-react';
import { Mode, plugin as markdown } from 'vite-plugin-markdown';
import { defineConfig } from 'vite';
import { readFileSync } from 'node:fs';
import { fileURLToPath } from 'node:url';
const { version, surreal } = JSON.parse(readFileSync('./package.json', 'utf8'));
// https://vitejs.dev/config/
export default defineConfig({
plugins: [
react(),
markdown({
mode: [Mode.HTML]
})
],
clearScreen: false,
envPrefix: ['VITE_', 'TAURI_'],
server: {
port: 1420,
strictPort: true
},
build: {
target: "esnext",
minify: process.env.TAURI_DEBUG ? false : 'esbuild',
sourcemap: !!process.env.TAURI_DEBUG,
rollupOptions: {
input: {
'surrealist': '/index.html',
'mini-run': '/mini/run.html',
'mini-new': '/mini/new.html'
}
},
},
esbuild: {
supported: {
'top-level-await': true //browsers can handle top-level-await features
},
},
resolve: {
alias: {
'~': fileURLToPath(new URL('src', import.meta.url))
}
},
css: {
modules: {
localsConvention: 'dashesOnly'
},
preprocessorOptions: {
scss: {
additionalData: '@import "~/assets/styles/mixins.scss";',
},
},
},
define: {
'import.meta.env.VERSION': `"${version}"`,
'import.meta.env.SDB_VERSION': `"${surreal}"`,
'import.meta.env.POSTHOG_KEY': `"phc_BWVuHaJuhnFi3HthLhb9l8opktRrNeFHVnisZdQ5404"`,
'import.meta.env.POSTHOG_URL': `"https://eu.i.posthog.com"`,
},
optimizeDeps: {
exclude: ['surrealdb.wasm', 'surrealql.wasm'],
esbuildOptions: {
target: 'esnext',
},
},
assetsInclude: ['**/surrealdb.wasm/dist/*.wasm', '**/surrealql.wasm/dist/*.wasm']
});