You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
52 lines
1.5 KiB
TypeScript
52 lines
1.5 KiB
TypeScript
/*
|
|
* @Author: donghao donghao@supervision.ltd
|
|
* @Date: 2025-03-06 11:27:03
|
|
* @LastEditors: donghao donghao@supervision.ltd
|
|
* @LastEditTime: 2025-03-07 14:35:23
|
|
* @FilePath: \vite-ai\data-dashboard\vite.config.ts
|
|
* @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
|
|
*/
|
|
import { defineConfig, loadEnv } from 'vite'
|
|
import { resolve } from "path";
|
|
import vue from '@vitejs/plugin-vue'
|
|
import { viteMockServe } from 'vite-plugin-mock'
|
|
import AutoImport from "unplugin-auto-import/vite";
|
|
|
|
/** 路径查找 */
|
|
const pathResolve = (dir: string): string => {
|
|
return resolve(__dirname, ".", dir);
|
|
};
|
|
|
|
export default defineConfig(({ mode }) => {
|
|
const env = loadEnv(mode, process.cwd(), '')
|
|
|
|
return {
|
|
resolve: {
|
|
alias: [
|
|
{ find: /^@\//, replacement: resolve(__dirname, "src") + "/" },
|
|
{ find: /^~/, replacement: "" },
|
|
{ find: /^@build\//, replacement: pathResolve("build") }
|
|
]
|
|
},
|
|
plugins: [
|
|
vue(),
|
|
viteMockServe({
|
|
mockPath: 'mock', // 模拟数据文件存放的目录
|
|
localEnabled: env.VITE_MOCK_ENABLED === 'true',
|
|
rodEnabled: false, // 生产环境是否开启 mock 功能
|
|
}),
|
|
AutoImport({
|
|
imports: ["vue"],
|
|
eslintrc: {
|
|
enabled: true
|
|
}
|
|
})
|
|
],
|
|
server: {
|
|
port: parseInt(env.VITE_PORT) || 5050
|
|
},
|
|
define: {
|
|
'process.env': env
|
|
}
|
|
}
|
|
}) |