feat: enhance Vite configuration with dotenv and PWA support
- Added dotenv for environment variable management. - Updated API URL handling to support fallback options. - Integrated VitePWA plugin for progressive web app capabilities.
This commit is contained in:
27
package.json
27
package.json
@@ -17,49 +17,50 @@
|
||||
"author": "abearxiong <xiongxiao@xiongxiao.me>",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@base-ui/react": "^1.2.0",
|
||||
"@base-ui/react": "^1.3.0",
|
||||
"@kevisual/api": "^0.0.64",
|
||||
"@kevisual/context": "^0.0.8",
|
||||
"@kevisual/router": "0.1.1",
|
||||
"@kevisual/router": "0.1.2",
|
||||
"@tanstack/react-query": "^5.90.21",
|
||||
"@tanstack/react-router": "^1.166.7",
|
||||
"@tanstack/react-router": "^1.167.3",
|
||||
"class-variance-authority": "^0.7.1",
|
||||
"clsx": "^2.1.1",
|
||||
"cmdk": "^1.1.1",
|
||||
"convex": "^1.32.0",
|
||||
"dayjs": "^1.11.19",
|
||||
"convex": "^1.33.1",
|
||||
"dayjs": "^1.11.20",
|
||||
"es-toolkit": "^1.45.1",
|
||||
"fuse.js": "^7.1.0",
|
||||
"lucide-react": "^0.577.0",
|
||||
"nanoid": "^5.1.6",
|
||||
"nanoid": "^5.1.7",
|
||||
"next-themes": "^0.4.6",
|
||||
"react": "^19.2.4",
|
||||
"react-dom": "^19.2.4",
|
||||
"react-hook-form": "^7.71.2",
|
||||
"sonner": "^2.0.7",
|
||||
"zustand": "^5.0.11"
|
||||
"zustand": "^5.0.12"
|
||||
},
|
||||
"publishConfig": {
|
||||
"access": "public"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@kevisual/ai": "0.0.28",
|
||||
"@kevisual/kv-login": "^0.1.17",
|
||||
"@kevisual/query": "0.0.53",
|
||||
"@kevisual/ai": "0.0.28",
|
||||
"@kevisual/types": "^0.0.12",
|
||||
"@kevisual/vite-html-plugin": "^0.0.1",
|
||||
"@tailwindcss/vite": "^4.2.1",
|
||||
"@tanstack/react-router-devtools": "^1.166.7",
|
||||
"@tanstack/router-plugin": "^1.166.7",
|
||||
"@types/node": "^25.4.0",
|
||||
"@tanstack/react-router-devtools": "^1.166.9",
|
||||
"@tanstack/router-plugin": "^1.166.12",
|
||||
"@types/node": "^25.5.0",
|
||||
"@types/react": "^19.2.14",
|
||||
"@types/react-dom": "^19.2.3",
|
||||
"@vitejs/plugin-react": "^5.1.4",
|
||||
"@vitejs/plugin-react": "^6.0.1",
|
||||
"dotenv": "^17.3.1",
|
||||
"tailwind-merge": "^3.5.0",
|
||||
"tailwindcss": "^4.2.1",
|
||||
"tw-animate-css": "^1.4.0",
|
||||
"typescript": "^5.9.3",
|
||||
"vite": "v8.0.0-beta.18"
|
||||
"vite": "v8.0.0",
|
||||
"vite-plugin-pwa": "^1.2.0"
|
||||
}
|
||||
}
|
||||
3479
pnpm-lock.yaml
generated
3479
pnpm-lock.yaml
generated
File diff suppressed because it is too large
Load Diff
@@ -4,12 +4,14 @@ import path from 'path';
|
||||
import pkgs from './package.json';
|
||||
import tailwindcss from '@tailwindcss/vite';
|
||||
import { tanstackRouter } from '@tanstack/router-plugin/vite'
|
||||
import 'dotenv/config';
|
||||
import dotenv from 'dotenv';
|
||||
import { VitePWA } from 'vite-plugin-pwa';
|
||||
|
||||
const isDev = process.env.NODE_ENV === 'development';
|
||||
const env = dotenv.config().parsed || {};
|
||||
const isDev = env.NODE_ENV === 'development' || process.env.NODE_ENV === 'development';
|
||||
const basename = isDev ? '/' : pkgs?.basename || '/';
|
||||
|
||||
let target = process.env.VITE_API_URL || 'http://localhost:51515';
|
||||
let target = env.VITE_API_URL || process.env.API_URL || 'http://localhost:51515';
|
||||
const apiProxy = { target: target, changeOrigin: true, ws: true, rewriteWsOrigin: true, secure: false, cookieDomainRewrite: 'localhost' };
|
||||
let proxy = {
|
||||
'/root/': apiProxy,
|
||||
@@ -27,7 +29,10 @@ export default defineConfig({
|
||||
autoCodeSplitting: true,
|
||||
}),
|
||||
react(),
|
||||
tailwindcss()
|
||||
tailwindcss(),
|
||||
VitePWA({
|
||||
injectRegister: 'auto',
|
||||
}),
|
||||
],
|
||||
resolve: {
|
||||
alias: {
|
||||
|
||||
Reference in New Issue
Block a user