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