openpencil/vite.config.ts
2026-02-28 08:10:09 +03:00

41 lines
902 B
TypeScript

import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
import tailwindcss from '@tailwindcss/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 () => ({
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(),
vue()
],
clearScreen: false,
server: {
port: 1420,
strictPort: true,
host: host || false,
hmr: host
? {
protocol: 'ws',
host,
port: 1421
}
: undefined,
watch: {
ignored: ['**/desktop/**']
}
}
}))