1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768 |
- import {
- defineConfig
- } from 'vite'
- import vue from '@vitejs/plugin-vue'
- import WindiCSS from 'vite-plugin-windicss'
- import Components from 'unplugin-vue-components/vite'
- import {
- ElementPlusResolver
- } from 'unplugin-vue-components/resolvers'
- import {
- resolve
- } from 'path';
- const pathResolve = (dir) => {
- return resolve(__dirname, '.', dir);
- };
- const alias = {
- '@': pathResolve('./src/'),
- '@tools': pathResolve('./src/tools'),
- '@api': pathResolve('./src/api'),
- '@com': pathResolve('./src/components'),
- '/@': pathResolve('./src/'),
- };
- // https://vitejs.dev/config/
- export default defineConfig({
- base: process.env.ELECTRON == "true" ? './' : "./",
- resolve: {
- alias
- },
- build: {
- sourcemap: false
- },
- optimizeDeps: {
- include: ["element-plus/lib/locale/lang/zh-cn"],
- },
- plugins: [
- Components({
- resolvers: [ElementPlusResolver()],
- }),
- WindiCSS(),
- vue()
- ],
- server: {
- host: '0.0.0.0',
- open: false, //自动打开
- base: "./ ", //生产环境路径
- proxy: { // 本地开发环境通过代理实现跨域,生产环境使用 nginx 转发
- // // 正则表达式写法
- // '^/sharding': {
- // // target: 'http://10.155.32.14:8082/sharding',
- // target: 'http://192.168.10.8:9002',
- // changeOrigin: true, //开启代理
- // rewrite: (path) => path.replace(/^\/sharding/, '')
- // },
- // '^/adapter': {
- // // target: 'http://10.155.32.14:8082/sharding',
- // target: 'http://192.168.10.8:9002',
- // changeOrigin: true, //开启代理
- // rewrite: (path) => path.replace(/^\/adapter/, '')
- // },
- // '^/current': {
- // // target: 'http://10.155.32.14:8082/sharding',
- // target: 'http://192.168.10.8:9002',
- // changeOrigin: true, //开启代理
- // rewrite: (path) => path.replace(/^\/current/, '')
- // },
- }
- },
- })
|