2023-07-07 11:36:32 +00:00
|
|
|
import react from "@vitejs/plugin-react";
|
|
|
|
import { defineConfig } from "vite";
|
2023-07-09 22:42:06 +00:00
|
|
|
import { VitePWA } from "vite-plugin-pwa";
|
2023-07-07 11:36:32 +00:00
|
|
|
|
|
|
|
export default defineConfig(() => {
|
|
|
|
return {
|
2023-07-08 08:57:34 +00:00
|
|
|
server: {
|
|
|
|
proxy: {
|
|
|
|
"/chatapi": {
|
|
|
|
target: "http://localhost:3001",
|
|
|
|
secure: false,
|
|
|
|
changeOrigin: true,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
2023-07-07 11:36:32 +00:00
|
|
|
build: {
|
|
|
|
outDir: "build",
|
2023-07-09 22:42:06 +00:00
|
|
|
target: "es2020",
|
|
|
|
sourcemap: true,
|
2023-07-09 19:24:17 +00:00
|
|
|
},
|
|
|
|
esbuild: {
|
2023-07-09 22:42:06 +00:00
|
|
|
target: "es2020",
|
2023-07-07 11:36:32 +00:00
|
|
|
},
|
|
|
|
resolve: {
|
|
|
|
alias: {
|
|
|
|
"@ffmpeg/ffmpeg": "./src/stub.js",
|
|
|
|
},
|
|
|
|
},
|
|
|
|
plugins: [
|
|
|
|
react({
|
|
|
|
babel: {
|
|
|
|
plugins: [
|
|
|
|
[
|
|
|
|
"formatjs",
|
|
|
|
{
|
|
|
|
idInterpolationPattern: "[sha512:contenthash:base64:6]",
|
|
|
|
ast: true,
|
|
|
|
},
|
|
|
|
],
|
|
|
|
],
|
|
|
|
},
|
|
|
|
}),
|
2023-07-09 22:42:06 +00:00
|
|
|
VitePWA({
|
|
|
|
registerType: "autoUpdate",
|
|
|
|
includeAssets: ["favicon.ico", "lang/*.json"],
|
|
|
|
manifest: {
|
|
|
|
short_name: "Chat with GPT",
|
|
|
|
name: "Chat with GPT",
|
|
|
|
start_url: ".",
|
|
|
|
display: "standalone",
|
|
|
|
theme_color: "#000000",
|
|
|
|
background_color: "#ffffff",
|
|
|
|
icons: [
|
|
|
|
{
|
|
|
|
src: "logo192.png",
|
|
|
|
type: "image/png",
|
|
|
|
sizes: "192x192",
|
|
|
|
},
|
|
|
|
{
|
|
|
|
src: "logo512.png",
|
|
|
|
type: "image/png",
|
|
|
|
sizes: "512x512",
|
|
|
|
},
|
|
|
|
],
|
|
|
|
},
|
|
|
|
workbox: {
|
|
|
|
runtimeCaching: [
|
|
|
|
{
|
|
|
|
urlPattern: /^https:\/\/fonts\.googleapis\.com\/.*/i,
|
|
|
|
handler: "CacheFirst",
|
|
|
|
options: {
|
|
|
|
cacheName: "google-fonts-cache",
|
|
|
|
expiration: {
|
|
|
|
maxEntries: 10,
|
|
|
|
maxAgeSeconds: 60 * 60 * 24 * 365,
|
|
|
|
},
|
|
|
|
cacheableResponse: {
|
|
|
|
statuses: [0, 200],
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
|
|
|
urlPattern: /^https:\/\/fonts\.gstatic\.com\/.*/i,
|
|
|
|
handler: "CacheFirst",
|
|
|
|
options: {
|
|
|
|
cacheName: "gstatic-fonts-cache",
|
|
|
|
expiration: {
|
|
|
|
maxEntries: 10,
|
|
|
|
maxAgeSeconds: 60 * 60 * 24 * 365,
|
|
|
|
},
|
|
|
|
cacheableResponse: {
|
|
|
|
statuses: [0, 200],
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
|
|
|
urlPattern: /^https:\/\/cdnjs\.cloudflare\.com\/.*/i,
|
|
|
|
handler: "CacheFirst",
|
|
|
|
options: {
|
|
|
|
cacheName: "cloudflare-js-cdn",
|
|
|
|
expiration: {
|
|
|
|
maxEntries: 10,
|
|
|
|
maxAgeSeconds: 60 * 60 * 24 * 365,
|
|
|
|
},
|
|
|
|
cacheableResponse: {
|
|
|
|
statuses: [0, 200],
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
|
|
|
urlPattern: /^https:\/\/cdn\.jsdelivr\.net\/.*/i,
|
|
|
|
handler: "CacheFirst",
|
|
|
|
options: {
|
|
|
|
cacheName: "jsdelivr-cdn",
|
|
|
|
expiration: {
|
|
|
|
maxEntries: 10,
|
|
|
|
maxAgeSeconds: 60 * 60 * 24 * 365,
|
|
|
|
},
|
|
|
|
cacheableResponse: {
|
|
|
|
statuses: [0, 200],
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
],
|
|
|
|
},
|
|
|
|
}),
|
2023-07-07 11:36:32 +00:00
|
|
|
],
|
|
|
|
};
|
|
|
|
});
|