mirror of
https://github.com/coaidev/coai.git
synced 2025-05-23 23:10:13 +09:00
79 lines
1.7 KiB
TypeScript
79 lines
1.7 KiB
TypeScript
import { defineConfig } from 'vite'
|
|
import react from '@vitejs/plugin-react-swc'
|
|
import path from "path"
|
|
import { createHtmlPlugin } from 'vite-plugin-html'
|
|
import { VitePWA } from "vite-plugin-pwa";
|
|
|
|
// https://vitejs.dev/config/
|
|
export default defineConfig({
|
|
plugins: [
|
|
react(),
|
|
createHtmlPlugin({
|
|
minify: true,
|
|
}),
|
|
VitePWA({
|
|
registerType: 'autoUpdate',
|
|
manifest: {
|
|
id: "chatnio",
|
|
name: "Chat Nio",
|
|
short_name: "Chat Nio",
|
|
description: "👋 Chat Nio, lightweight Web ChatGPT chat site",
|
|
theme_color: "#0a0a0a",
|
|
icons: [{
|
|
src: "/logo.png",
|
|
sizes: "64x64",
|
|
type: "image/png",
|
|
}],
|
|
start_url: "/",
|
|
},
|
|
workbox: {
|
|
clientsClaim: true,
|
|
skipWaiting: true,
|
|
cleanupOutdatedCaches: true,
|
|
runtimeCaching: [{
|
|
urlPattern: new RegExp('^https://open.lightxi.com/'),
|
|
handler: "CacheFirst",
|
|
options: {
|
|
cacheName: "lightxi-cdn",
|
|
expiration: {
|
|
maxEntries: 10,
|
|
maxAgeSeconds: 60 * 60 * 24 * 365,
|
|
}
|
|
}
|
|
}],
|
|
},
|
|
}),
|
|
],
|
|
resolve: {
|
|
alias: {
|
|
"@": path.resolve(__dirname, "./src"),
|
|
},
|
|
},
|
|
css: {
|
|
preprocessorOptions: {
|
|
less: {
|
|
javascriptEnabled: true,
|
|
}
|
|
}
|
|
},
|
|
build: {
|
|
manifest: true,
|
|
rollupOptions: {
|
|
output: {
|
|
entryFileNames: `assets/[name].[hash].js`,
|
|
chunkFileNames: `assets/[name].[hash].js`,
|
|
},
|
|
},
|
|
},
|
|
server: {
|
|
proxy: {
|
|
"/api": {
|
|
target: "http://localhost:8094",
|
|
changeOrigin: true,
|
|
rewrite: (path) => path.replace(/^\/api/, ""),
|
|
ws: true,
|
|
}
|
|
}
|
|
}
|
|
});
|