初始化仓库
This commit is contained in:
56
vite.config.ts
Normal file
56
vite.config.ts
Normal file
@@ -0,0 +1,56 @@
|
||||
import { defineConfig, loadEnv } from 'vite';
|
||||
import Components from "unplugin-vue-components/vite"; // 按需组件自动导入
|
||||
import { AntDesignVueResolver } from "unplugin-vue-components/resolvers";
|
||||
import vue from '@vitejs/plugin-vue';
|
||||
import Icons from 'unplugin-icons/vite';
|
||||
import IconsResolver from 'unplugin-icons/resolver';
|
||||
import path from 'path';
|
||||
|
||||
// https://vite.dev/config/
|
||||
export default defineConfig(({ mode }) => {
|
||||
|
||||
const env = loadEnv(mode, process.cwd());
|
||||
|
||||
return {
|
||||
resolve: {
|
||||
alias: {
|
||||
"@": path.resolve(__dirname, "src"),
|
||||
},
|
||||
},
|
||||
server: {
|
||||
proxy: {
|
||||
"/api": {
|
||||
target: env.VITE_APP_BASE_URL,
|
||||
changeOrigin: true,
|
||||
rewrite: (path) => path.replace(/^\/api\//, "/"),
|
||||
},
|
||||
"/prod-api": {
|
||||
target: env.VITE_APP_BASE_URL,
|
||||
changeOrigin: true,
|
||||
rewrite: (path) => path.replace(/^\/prod-api\//, "/"),
|
||||
},
|
||||
},
|
||||
},
|
||||
plugins: [
|
||||
vue(),
|
||||
Components({
|
||||
dts: true, //生成components.d.ts 全局定义文件
|
||||
resolvers: [
|
||||
AntDesignVueResolver({
|
||||
//对使用到的全局ant design vue组件进行类型导入
|
||||
importStyle: false, // 不动态引入css,这个不强求
|
||||
}),
|
||||
// 自动导入 lucide 图标
|
||||
IconsResolver({
|
||||
prefix: "i", // 比如用 <i-a-arrow-down />
|
||||
enabledCollections: ["lucide"],
|
||||
}),
|
||||
],
|
||||
include: [/\.vue$/, /\.vue\?vue/, /\.md$/, /\.tsx$/], //包含的文件类型
|
||||
}),
|
||||
Icons({
|
||||
autoInstall: true, // 没安装的图标库会自动下载
|
||||
}),
|
||||
],
|
||||
};
|
||||
});
|
||||
Reference in New Issue
Block a user