vue-stream-markdown bundles all 359 shiki grammar chunks by default. We only need plain text code blocks in chat. Alias shiki to an empty module — build drops from 20MB/377 files to 11MB/103 files.
54 lines
1.3 KiB
TypeScript
54 lines
1.3 KiB
TypeScript
import { resolve } from 'path'
|
|
|
|
import { defineConfig } from 'vite'
|
|
import vue from '@vitejs/plugin-vue'
|
|
import tailwindcss from '@tailwindcss/vite'
|
|
import Icons from 'unplugin-icons/vite'
|
|
import IconsResolver from 'unplugin-icons/resolver'
|
|
import Components from 'unplugin-vue-components/vite'
|
|
import { copyFileSync, existsSync } from 'fs'
|
|
|
|
// @ts-expect-error process is a nodejs global
|
|
const host = process.env.TAURI_DEV_HOST
|
|
|
|
export default defineConfig(async () => ({
|
|
resolve: {
|
|
alias: {
|
|
'@': resolve(__dirname, 'src'),
|
|
shiki: resolve(__dirname, 'src/shims/shiki.ts')
|
|
}
|
|
},
|
|
plugins: [
|
|
{
|
|
name: 'copy-canvaskit-wasm',
|
|
buildStart() {
|
|
const src = 'node_modules/canvaskit-wasm/bin/canvaskit.wasm'
|
|
const dest = 'public/canvaskit.wasm'
|
|
if (existsSync(src) && !existsSync(dest)) {
|
|
copyFileSync(src, dest)
|
|
}
|
|
}
|
|
},
|
|
tailwindcss(),
|
|
Icons({ compiler: 'vue3' }),
|
|
Components({ resolvers: [IconsResolver({ prefix: 'icon' })] }),
|
|
vue()
|
|
],
|
|
clearScreen: false,
|
|
server: {
|
|
port: 1420,
|
|
strictPort: true,
|
|
host: host || false,
|
|
hmr: host
|
|
? {
|
|
protocol: 'ws',
|
|
host,
|
|
port: 1421
|
|
}
|
|
: undefined,
|
|
watch: {
|
|
ignored: ['**/desktop/**']
|
|
}
|
|
}
|
|
}))
|