1 Star 0 Fork 55

王海新/sz-admin

forked from INS6/sz-admin 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
vite.config.ts 1.52 KB
一键复制 编辑 原始数据 按行查看 历史
INS6 提交于 2024-06-09 20:19 . 优化:页脚增加版本号展示
import { resolve } from "path";
import {fileURLToPath, URL} from 'node:url'
import {defineConfig, ConfigEnv, UserConfig, loadEnv} from 'vite'
import vue from '@vitejs/plugin-vue'
import vueJsx from '@vitejs/plugin-vue-jsx'
import {createSvgIconsPlugin} from "vite-plugin-svg-icons";
const path = require('node:path');
// https://vitejs.dev/config/
export default defineConfig(({mode}: ConfigEnv): UserConfig => {
const root: string = process.cwd();
const env: Record<string, string> = loadEnv(mode, root);
return {
base: env.VITE_PUBLIC_PATH,
root,
plugins: [
vue(),
vueJsx(),
// 使用 svg 图标
createSvgIconsPlugin({
iconDirs: [resolve(process.cwd(), "src/assets/icons")],
symbolId: "icon-[dir]-[name]"
}),
],
resolve: {
alias: {
'@': fileURLToPath(new URL('./src', import.meta.url)),
'package.json': path.resolve(__dirname, 'package.json')
}
},
css: {
preprocessorOptions: {
scss: {
additionalData: `@use "@/styles/element/index.scss" as *;`
}
}
},
server: {
host: "0.0.0.0",
port: Number(env.VITE_PORT),
open: env.VITE_OPEN === "true",
proxy: {
"/api": {
target: env.VITE_API_URL,
changeOrigin: true,
ws: true,
rewrite: path => path.replace(new RegExp(`^/api`), ""),
// https is require secure=false
...(/^https:\/\//.test(env.VITE_API_URL) ? {secure: false} : {})
}
},
},
}
})
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/wanghaixin811/sz-admin.git
git@gitee.com:wanghaixin811/sz-admin.git
wanghaixin811
sz-admin
sz-admin
main

搜索帮助