-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvite.config.ts
44 lines (41 loc) · 1.1 KB
/
vite.config.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
/*
* @Author: dream [email protected]
* @Date: 2022-05-25 21:33:53
* @LastEditors: dream [email protected]
* @LastEditTime: 2022-05-25 21:35:57
* @FilePath: \vite-vue3-ts-admin\vite.config.ts
* @Description:
*
* Copyright (c) 2022 by dream [email protected], All Rights Reserved.
*/
import { resolve } from 'path';
import { defineConfig, UserConfig, ServerOptions } from 'vite';
import getPluginsList from './build/vite/plugins';
// 使用node转换路径
const pathResolve = (dir: string): string => {
return resolve(__dirname, '.', dir);
};
// 路径别名
const alias: Record<string, string> = {
'/@': pathResolve('src'),
// '/#': pathResolve('build'),
};
// 开发服务器
const server: ServerOptions = {
host: true,
port: 4396,
};
// https://vitejs.dev/config/
export default defineConfig((): UserConfig => {
return {
resolve: {
// 别名
alias,
extensions: ['.mjs', '.js', '.ts', '.jsx', '.tsx', '.json'],
},
// 插件列表
plugins: getPluginsList(),
// 开发服务器配置
server,
};
});