mirror of
https://github.com/Dvorinka/Trackeep.git
synced 2026-06-03 12:03:00 +00:00
b083dac3f0
Add real API support in demo mode with credential checking, implement build-time version injection from package.json, and refactor update checking with 24-hour caching. Migrate landing page from Vue to Astro with comprehensive UI components including Hero, Features, Benefits, and Tech Stack sections. Update CI/CD workflow with expanded cache paths and security scanner version pinned.
62 lines
1.6 KiB
TypeScript
62 lines
1.6 KiB
TypeScript
import { defineConfig, loadEnv } from 'vite'
|
|
import solid from 'vite-plugin-solid'
|
|
import UnoCSS from 'unocss/vite'
|
|
import path from 'path'
|
|
import { readFileSync } from 'fs'
|
|
|
|
// Read version from package.json
|
|
const packageJson = JSON.parse(readFileSync(path.resolve(__dirname, './package.json'), 'utf8'))
|
|
const version = packageJson.version
|
|
|
|
export default defineConfig(({ mode }) => {
|
|
// Load env file from parent directory
|
|
loadEnv(mode, path.resolve(__dirname, '..'), '')
|
|
|
|
return {
|
|
plugins: [solid(), UnoCSS()],
|
|
define: {
|
|
// Make version available at build time
|
|
__APP_VERSION__: JSON.stringify(version)
|
|
},
|
|
resolve: {
|
|
alias: {
|
|
'@': path.resolve(__dirname, './src'),
|
|
},
|
|
},
|
|
build: {
|
|
target: 'esnext',
|
|
minify: 'terser',
|
|
sourcemap: false,
|
|
// Add asset optimization
|
|
assetsInlineLimit: 4096,
|
|
// Add CSS code splitting
|
|
cssCodeSplit: true,
|
|
rollupOptions: {
|
|
output: {
|
|
manualChunks: {
|
|
vendor: ['solid-js', '@solidjs/router'],
|
|
ui: ['@kobalte/core', '@tabler/icons-solidjs'],
|
|
query: ['@tanstack/solid-query'],
|
|
},
|
|
// Optimize chunk naming for caching
|
|
chunkFileNames: 'assets/[name]-[hash].js',
|
|
entryFileNames: 'assets/[name]-[hash].js',
|
|
assetFileNames: 'assets/[name]-[hash].[ext]',
|
|
},
|
|
},
|
|
// Add compression for static hosting
|
|
reportCompressedSize: true,
|
|
},
|
|
server: {
|
|
port: 3000,
|
|
host: true,
|
|
hmr: {
|
|
overlay: false,
|
|
},
|
|
},
|
|
optimizeDeps: {
|
|
include: ['solid-js', '@solidjs/router', '@kobalte/core'],
|
|
},
|
|
}
|
|
})
|