tdesign-vue-next-starter/vite.config.ts

54 lines
1.2 KiB
TypeScript
Raw Normal View History

import { defineConfig } from 'vite';
import { viteMockServe } from 'vite-plugin-mock';
import { viteThemePlugin } from 'vite-plugin-theme';
import createVuePlugin from '@vitejs/plugin-vue';
import vueJsx from '@vitejs/plugin-vue-jsx';
2021-11-19 15:25:24 +08:00
import svgLoader from 'vite-svg-loader';
2021-11-08 10:19:58 +08:00
// import HttpProxyAgent from 'http-proxy-agent';
import path from 'path';
2021-11-08 10:19:58 +08:00
// import proxy from './src/config/proxy';
import { getColorList, getGreyColor, getBrandColor } from './src/config/color';
import USER_CONFIG from './src/config/style';
const { brandTheme, backgroundTheme } = USER_CONFIG;
// https://vitejs.dev/config/
export default defineConfig({
resolve: {
alias: {
'~': path.resolve(__dirname, './'),
'@': path.resolve(__dirname, './src'),
},
},
css: {
preprocessorOptions: {
less: {
modifyVars: {
...getBrandColor(brandTheme),
...getGreyColor(backgroundTheme),
},
},
},
},
plugins: [
createVuePlugin(),
vueJsx(),
viteMockServe({
mockPath: 'mock',
localEnabled: true,
}),
viteThemePlugin({
colorVariables: getColorList([getGreyColor(backgroundTheme), getBrandColor(brandTheme)]),
}),
2021-11-16 19:01:03 +08:00
svgLoader(),
],
server: {
port: 3002,
},
});