* feat: add PWA support with offline capabilities - Add web app manifest with icons and theme configuration - Add service worker with cache-first strategy for static assets - Add useServiceWorker hook for SW registration - Add PWA meta tags and Apple-specific tags to index.html - Update vite.config.ts for optimal asset caching * Update package-lock.json
47 lines
1.5 KiB
TypeScript
47 lines
1.5 KiB
TypeScript
import path from "path";
|
|
import fs from "fs";
|
|
import tailwindcss from "@tailwindcss/vite";
|
|
import { defineConfig } from "vite";
|
|
import react from "@vitejs/plugin-react";
|
|
|
|
const sslCertPath = path.join(process.cwd(), "ssl/termix.crt");
|
|
const sslKeyPath = path.join(process.cwd(), "ssl/termix.key");
|
|
|
|
const hasSSL = fs.existsSync(sslCertPath) && fs.existsSync(sslKeyPath);
|
|
const useHTTPS = process.env.VITE_HTTPS === "true" && hasSSL;
|
|
|
|
export default defineConfig({
|
|
plugins: [react(), tailwindcss()],
|
|
resolve: {
|
|
alias: {
|
|
"@": path.resolve(__dirname, "./src"),
|
|
},
|
|
},
|
|
base: "./",
|
|
build: {
|
|
sourcemap: false,
|
|
assetsInlineLimit: 0,
|
|
rollupOptions: {
|
|
output: {
|
|
manualChunks: {
|
|
'react-vendor': ['react', 'react-dom'],
|
|
'ui-vendor': ['@radix-ui/react-dialog', '@radix-ui/react-dropdown-menu', '@radix-ui/react-select', '@radix-ui/react-tabs', '@radix-ui/react-switch', '@radix-ui/react-tooltip', '@radix-ui/react-scroll-area', '@radix-ui/react-separator', 'lucide-react', 'clsx', 'tailwind-merge', 'class-variance-authority'],
|
|
'monaco': ['monaco-editor'],
|
|
'codemirror': ['@uiw/react-codemirror', '@codemirror/view', '@codemirror/state', '@codemirror/language', '@codemirror/commands', '@codemirror/search', '@codemirror/autocomplete'],
|
|
}
|
|
}
|
|
},
|
|
chunkSizeWarningLimit: 1000,
|
|
},
|
|
server: {
|
|
https: useHTTPS
|
|
? {
|
|
cert: fs.readFileSync(sslCertPath),
|
|
key: fs.readFileSync(sslKeyPath),
|
|
}
|
|
: false,
|
|
port: 5173,
|
|
host: "localhost",
|
|
},
|
|
});
|