1 Star 0 Fork 251

土豆你个西红柿/mall-admin

forked from 有来技术团队/mall-admin
Closed
 
Create your Gitee Account
Explore and code with more than 12 million developers,Free private repositories !:)
Sign up
Clone or Download
vite.config.ts 1.32 KB
Copy Edit Raw Blame History
import { UserConfig, ConfigEnv, loadEnv } from 'vite';
import vue from '@vitejs/plugin-vue';
import { createSvgIconsPlugin } from 'vite-plugin-svg-icons';
import path from 'path';
// @see: https://gitee.com/holysheng/vite2-config-description/blob/master/vite.config.ts
export default ({ mode }: ConfigEnv): UserConfig => {
// 获取 .env 环境配置文件
const env = loadEnv(mode, process.cwd());
return {
plugins: [
vue(),
createSvgIconsPlugin({
// 指定需要缓存的图标文件夹
iconDirs: [path.resolve(process.cwd(), 'src/assets/icons')],
// 指定symbolId格式
symbolId: 'icon-[dir]-[name]',
}),
],
// 本地反向代理解决浏览器跨域限制
server: {
host: 'localhost',
port: Number(env.VITE_APP_PORT),
open: true, // 运行自动打开浏览器
proxy: {
[env.VITE_APP_BASE_API]: {
// 线上API地址
// target: 'https://api.youlai.tech',
// 本地API地址
target: 'http://localhost:9999',
changeOrigin: true,
rewrite: (path) =>
path.replace(new RegExp('^' + env.VITE_APP_BASE_API), ''),
},
},
},
resolve: {
// Vite路径别名配置
alias: {
'@': path.resolve('./src'), // @代替src
},
},
};
};
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
TypeScript
1
https://gitee.com/ptot/mall-admin.git
git@gitee.com:ptot/mall-admin.git
ptot
mall-admin
mall-admin
master

Search