53 lines
1.2 KiB
TypeScript
53 lines
1.2 KiB
TypeScript
import { defineConfig,loadEnv } from 'vite';
|
|
import react from '@vitejs/plugin-react';
|
|
import svgrPlugin from '@arco-plugins/vite-plugin-svgr';
|
|
import vitePluginForArco from '@arco-plugins/vite-react';
|
|
import setting from './src/settings.json';
|
|
import { createHtmlPlugin } from "vite-plugin-html";
|
|
|
|
// https://vitejs.dev/config/
|
|
export default defineConfig(({mode})=>{
|
|
const env = loadEnv(mode, process.cwd(), '')
|
|
return {
|
|
server:{
|
|
port:9000,
|
|
proxy:{
|
|
'^/api': {
|
|
target: env.VITE_APP_BASE_URL,
|
|
changeOrigin: true,
|
|
rewrite: (path) => path.replace(/^\/api/, ''),
|
|
}
|
|
},
|
|
},
|
|
resolve: {
|
|
alias: [{ find: '@', replacement: '/src' }],
|
|
},
|
|
plugins: [
|
|
react(),
|
|
svgrPlugin({
|
|
svgrOptions: {},
|
|
}),
|
|
vitePluginForArco({
|
|
theme: '@arco-themes/react-arco-pro',
|
|
modifyVars: {
|
|
'arcoblue-6': setting.themeColor,
|
|
},
|
|
}),
|
|
createHtmlPlugin({
|
|
inject: {
|
|
data: {
|
|
title: env.VITE_APP_TITLE,
|
|
},
|
|
},
|
|
})
|
|
],
|
|
css: {
|
|
preprocessorOptions: {
|
|
less: {
|
|
javascriptEnabled: true,
|
|
},
|
|
},
|
|
},
|
|
}
|
|
});
|