mirror of
https://github.com/kccleoc/seedpgp-web.git
synced 2026-03-06 17:37:51 +08:00
- Update package.json version to v1.4.7 - Update README.md header to v1.4.7 - Update GEMINI.md version references to v1.4.7 - Update RECOVERY_PLAYBOOK.md version to v1.4.7 - Update SECURITY_AUDIT_REPORT.md version to v1.4.7 - Move documentation files to doc/ directory for better organization - Add new documentation files: LOCAL_TESTING_GUIDE.md, SERVE.md, TAILS_OFFLINE_PLAYBOOK.md - Add Makefile and serve.ts for improved development workflow
60 lines
1.4 KiB
TypeScript
60 lines
1.4 KiB
TypeScript
import { defineConfig } from 'vite'
|
|
import react from '@vitejs/plugin-react'
|
|
import basicSsl from '@vitejs/plugin-basic-ssl'
|
|
import wasm from 'vite-plugin-wasm'
|
|
import topLevelAwait from 'vite-plugin-top-level-await'
|
|
import { execSync } from 'child_process'
|
|
import fs from 'fs'
|
|
|
|
// Read version from package.json
|
|
const packageJson = JSON.parse(fs.readFileSync('./package.json', 'utf-8'))
|
|
const appVersion = packageJson.version
|
|
|
|
// Get git commit hash
|
|
const gitHash = execSync('git rev-parse --short HEAD').toString().trim()
|
|
|
|
export default defineConfig({
|
|
plugins: [
|
|
wasm(),
|
|
topLevelAwait(),
|
|
basicSsl(),
|
|
react(),
|
|
{
|
|
name: 'html-transform',
|
|
transformIndexHtml(html) {
|
|
return html.replace(/__APP_VERSION__/g, appVersion);
|
|
}
|
|
}
|
|
],
|
|
server: {
|
|
host: '0.0.0.0',
|
|
port: 5173,
|
|
strictPort: true,
|
|
https: true,
|
|
},
|
|
resolve: {
|
|
alias: {
|
|
buffer: 'buffer',
|
|
}
|
|
},
|
|
optimizeDeps: {
|
|
esbuildOptions: {
|
|
define: {
|
|
global: 'globalThis'
|
|
}
|
|
}
|
|
},
|
|
base: process.env.VITE_BASE_PATH || './', // Use relative paths for offline compatibility
|
|
publicDir: 'public', // ← Explicitly set (should be default)
|
|
build: {
|
|
outDir: 'dist',
|
|
emptyOutDir: false,
|
|
},
|
|
define: {
|
|
'__APP_VERSION__': JSON.stringify(appVersion),
|
|
'__BUILD_HASH__': JSON.stringify(gitHash),
|
|
'__BUILD_TIMESTAMP__': JSON.stringify(new Date().toISOString()),
|
|
'global': 'globalThis',
|
|
}
|
|
})
|