build(hololake): use runner config loading

This commit is contained in:
冰朔 2026-08-12 07:32:17 +08:00
commit 1cde630864
4 changed files with 16 additions and 11 deletions

View file

@ -14,11 +14,14 @@ import {
type Dirent,
} from 'fs'
import os from 'os'
import { fileURLToPath } from 'node:url'
import { defineConfig, type Plugin } from 'vite'
import react from '@vitejs/plugin-react'
import tailwindcss from '@tailwindcss/vite'
import matter from 'gray-matter'
const configDirectory = path.dirname(fileURLToPath(import.meta.url))
// --- Vault API middleware (dev only) ---
interface VaultEntry {
@ -962,7 +965,7 @@ export default defineConfig({
resolve: {
alias: {
'@': path.resolve(__dirname, './src'),
'@': path.resolve(configDirectory, './src'),
},
},
@ -972,7 +975,7 @@ export default defineConfig({
define: {
...(process.env.CI || (process.env.TAURI_PLATFORM && !process.env.TAURI_DEBUG)
? {}
: { __DEMO_VAULT_PATH__: JSON.stringify(path.resolve(__dirname, 'demo-vault-v2')) }),
: { __DEMO_VAULT_PATH__: JSON.stringify(path.resolve(configDirectory, 'demo-vault-v2')) }),
},
// Prevent vite from obscuring Rust errors
@ -993,7 +996,7 @@ export default defineConfig({
build: {
rollupOptions: process.env.VITE_HOLOLAKE_DISTRIBUTION === 'team-foundation'
? { input: path.resolve(__dirname, 'team-foundation.html') }
? { input: path.resolve(configDirectory, 'team-foundation.html') }
: undefined,
// Tauri uses Chromium on Windows and WebKit on macOS/Linux
target: process.env.TAURI_PLATFORM === 'windows' ? 'chrome105' : 'safari13',