这里是文章模块栏目内容页
vue vben admin开发的配置vite.config参考

开发配置往往考验着一个程序员的工作经验和解决工作问题的能力:

下面是实际使用模板中的配置参考:

import { defineApplicationConfig } from '@vben/vite-config';

export default defineApplicationConfig({
  overrides: {
    optimizeDeps: {
      include: [
        'echarts/core',
        'echarts/charts',
        'echarts/components',
        'echarts/renderers',
        'qrcode',
        '@iconify/iconify',
        'ant-design-vue/es/locale/zh_CN',
        'ant-design-vue/es/locale/en_US',
      ],
    },
    server: {
      proxy: {
        '/api': { 
          // target: 'http://192.168.2.7',
          target: '  
          changeOrigin: true,
          ws: true,
          // rewrite: (path) => {
          //   // 已调试接口列表
          //   const apiList = ['/api/login/adminUserInfo'];
          //   // 不在处理调式接口
          //   if (apiList.some((item) => path.indexOf(item) != -1)) {
          //     return path;
          //   } else {
          //     // console.log('path', path.replace(new RegExp(`^/api`), 'http://localhost:3000/basic-api'));
          //     return path.replace(new RegExp(`^/api`), 'http://localhost:3000/basic-api');
          //   }
          // },
          // only https
          // secure: false
        },
        '/basic-api': {
          target: 'http://localhost:3000',
          changeOrigin: true,
          ws: true,
          rewrite: (path) => path.replace(new RegExp(`^/basic-api`), ''),
          // only https
          // secure: false
        },
        '/upload': {
          target: 'http://localhost:3300/upload',
          changeOrigin: true,
          ws: true,
          rewrite: (path) => path.replace(new RegExp(`^/upload`), ''),
        },
      },
    },
  },
});

好了,感谢您的阅读,本文内容全部结束,希望能帮助到您》


更多栏目
相关内容