You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
53 lines
1.4 KiB
53 lines
1.4 KiB
import tailwindcss from "@tailwindcss/vite";
|
|
import react from "@vitejs/plugin-react";
|
|
import path from "path";
|
|
import { defineConfig } from "vite";
|
|
import viteCompression from "vite-plugin-compression";
|
|
|
|
export default defineConfig(({ mode }) => {
|
|
|
|
const isDev = mode === "development";
|
|
|
|
return {
|
|
plugins: [
|
|
react(),
|
|
tailwindcss(),
|
|
mode === "production" ? viteCompression({ algorithm: "gzip", ext: ".gz" }) : undefined,
|
|
].filter(Boolean),
|
|
resolve: {
|
|
alias: {
|
|
"@": path.resolve(__dirname, "src"),
|
|
},
|
|
},
|
|
server: {
|
|
port: 5195,
|
|
proxy: isDev
|
|
? {
|
|
"/api_client": {
|
|
target: "http://192.168.77.111:8080/",
|
|
// target: "https://wwwtest.popi.art/",
|
|
// target: "https://popi.yuanzoo.cn/",
|
|
secure: false,
|
|
changeOrigin: true,
|
|
},
|
|
}
|
|
: undefined,
|
|
},
|
|
build: {
|
|
target: "es2020",
|
|
sourcemap: mode !== "production",
|
|
rollupOptions: {
|
|
output: {
|
|
manualChunks: {
|
|
"react-vendor": ["react", "react-dom", "react-router-dom"],
|
|
"arco-vendor": ["@arco-design/web-react"],
|
|
"swiper-vendor": ["swiper"],
|
|
"markdown-vendor": ["react-markdown", "remark-gfm"],
|
|
"data-vendor": ["axios", "i18next", "react-i18next", "zustand"],
|
|
},
|
|
},
|
|
},
|
|
chunkSizeWarningLimit: 1000,
|
|
},
|
|
}
|
|
});
|
|
|