Files
ChopperBot/console-ui/vite.config.ts
T
2023-08-03 01:17:11 +08:00

67 lines
1.7 KiB
TypeScript

/// <reference types="vitest" />
// Plugins
import vue from "@vitejs/plugin-vue";
import vuetify from "vite-plugin-vuetify";
import AutoImport from "unplugin-auto-import/vite";
// Utilities
import { defineConfig } from "vite";
import { fileURLToPath, URL } from "node:url";
// https://vitejs.dev/config/
export default defineConfig({
plugins: [
vue(),
// https://github.com/vuetifyjs/vuetify-loader/tree/next/packages/vite-plugin
vuetify({
autoImport: true,
styles: { configFile: "src/styles/variables.scss" },
}),
AutoImport({
imports: ["vue", "vue-router", "pinia"],
}),
],
define: { "process.env": {} },
test: {
globals: true,
environment: "happy-dom",
},
resolve: {
alias: {
"~": fileURLToPath(new URL("./", import.meta.url)),
"@": fileURLToPath(new URL("./src", import.meta.url)),
"@data": fileURLToPath(new URL("./src/data", import.meta.url)),
},
extensions: [".js", ".json", ".jsx", ".mjs", ".ts", ".tsx", ".vue"],
},
server: {
port: 4399,
proxy: {
"/appApi": {
target: "http://localhost:8888",
changeOrigin: true,
rewrite: (path) => path.replace(/^\/appApi/, ""),
},
"/douyu": {
target: "https://www.douyu.com",
changeOrigin: true,
rewrite: (path) => path.replace(/^\/douyu/, "/"),
},
"/topic": {
target: "https://www.douyu.com",
changeOrigin: true,
}
},
},
css: {
preprocessorOptions: {
scss: { charset: false },
css: { charset: false },
},
},
cacheDir: ".vite_cache", // 将缓存目录设置为项目根目录下的 .vite_cache 文件夹
});