59 lines
1.5 KiB
TypeScript
59 lines
1.5 KiB
TypeScript
import { defineConfig } from "vite";
|
|
import react from "@vitejs/plugin-react-swc";
|
|
import path, { resolve } from "path";
|
|
import { inspectorServer } from "@react-dev-inspector/vite-plugin";
|
|
import basicSsl from "@vitejs/plugin-basic-ssl";
|
|
export default defineConfig({
|
|
// basicSsl()
|
|
plugins: [react()],
|
|
server: {
|
|
port: 3000,
|
|
host: "0.0.0.0",
|
|
open: true,
|
|
proxy: {
|
|
"/app-api": {
|
|
target: "https://petshy.tashowz.com",
|
|
changeOrigin: true,
|
|
},
|
|
},
|
|
},
|
|
css: {
|
|
modules: {},
|
|
preprocessorOptions: {
|
|
less: {
|
|
// 全局变量
|
|
// additionalData: `@import "${resolve(__dirname, "src/styles/variables.less")}";`,
|
|
// Less 选项
|
|
javascriptEnabled: true,
|
|
modifyVars: {
|
|
// 可以在这里定义全局变量
|
|
"@primary-color": "#1890ff",
|
|
"@border-radius-base": "6px",
|
|
},
|
|
},
|
|
},
|
|
},
|
|
resolve: {
|
|
alias: {
|
|
"@": path.resolve(__dirname, "./src"),
|
|
"@shared": path.resolve(__dirname, "../../packages/shared/src"),
|
|
"@hooks": path.resolve(__dirname, "../../packages/hooks/src"),
|
|
"@utils": path.resolve(__dirname, "../../packages/utils/src"),
|
|
},
|
|
},
|
|
build: {
|
|
rollupOptions: {
|
|
output: {
|
|
manualChunks: {
|
|
vendor: ["react", "react-dom"],
|
|
router: ["react-router-dom"],
|
|
},
|
|
},
|
|
},
|
|
chunkSizeWarningLimit: 1000,
|
|
},
|
|
optimizeDeps: {
|
|
include: ["@shared", "@hooks", "@utils"],
|
|
},
|
|
});
|