37 lines
1000 B
TypeScript
37 lines
1000 B
TypeScript
|
|
import { defineConfig } from '@vben/vite-config';
|
||
|
|
|
||
|
|
import ElementPlus from 'unplugin-element-plus/vite';
|
||
|
|
// import { ElementPlusResolver } from 'unplugin-vue-components/resolvers';
|
||
|
|
// import Components from 'unplugin-vue-components/vite'
|
||
|
|
import Components from 'unplugin-vue-components/vite';
|
||
|
|
import { ElementPlusResolver } from 'unplugin-vue-components/resolvers'
|
||
|
|
|
||
|
|
|
||
|
|
export default defineConfig(async () => {
|
||
|
|
return {
|
||
|
|
application: {},
|
||
|
|
vite: {
|
||
|
|
plugins: [
|
||
|
|
ElementPlus({
|
||
|
|
format: 'esm',
|
||
|
|
useSource: true,
|
||
|
|
}),
|
||
|
|
Components({
|
||
|
|
resolvers: [ElementPlusResolver({ importStyle: 'sass' })], // 自动导入组件与样式
|
||
|
|
}),
|
||
|
|
],
|
||
|
|
server: {
|
||
|
|
proxy: {
|
||
|
|
'/api': {
|
||
|
|
changeOrigin: true,
|
||
|
|
rewrite: (path) => path.replace(/^\/api/, ''),
|
||
|
|
// mock代理目标地址
|
||
|
|
target: 'http://localhost:5000/api',
|
||
|
|
ws: true,
|
||
|
|
},
|
||
|
|
},
|
||
|
|
},
|
||
|
|
},
|
||
|
|
};
|
||
|
|
});
|