无人机管理后台前端(已迁走)
shuishen
2024-09-10 1dd7827ff9c42a016a1e45913ce2fd78a79f4983
vite.config.mjs
@@ -1,21 +1,12 @@
import {
  defineConfig,
  loadEnv
} from 'vite';
import { resolve } from 'path'
import { defineConfig, loadEnv } from 'vite';
import { resolve } from 'path';
import createVitePlugins from './vite/plugins';
// https://vitejs.dev/config/
export default ({
  mode,
  command
}) => {
  const env = loadEnv(mode, process.cwd())
  const {
    VITE_APP_ENV,
    VITE_APP_BASE
  } = env
export default ({ mode, command }) => {
  const env = loadEnv(mode, process.cwd());
  const { VITE_APP_ENV, VITE_APP_BASE } = env;
  // 判断是打生产环境包
  const isProd = VITE_APP_ENV === 'production'
  const isProd = VITE_APP_ENV === 'production';
  // 根据是否生产环境,动态设置压缩配置
  const buildConfig = {
@@ -32,8 +23,8 @@
        drop_debugger: true, // 删除 debugger
      },
      format: {
        comments: false // 删除所有注释
      }
        comments: false, // 删除所有注释
      },
    };
  }
  return defineConfig({
@@ -41,14 +32,14 @@
    define: {
      __VUE_I18N_FULL_INSTALL__: true,
      __VUE_I18N_LEGACY_API__: true,
      __INTLIFY_PROD_DEVTOOLS__: false
      __INTLIFY_PROD_DEVTOOLS__: false,
    },
    server: {
      port: 2888,
      proxy: {
        '/api': {
          target: 'http://localhost',
          // target: 'https://wrj.shuixiongit.com/api',
          // target: 'http://localhost',
          target: 'https://wrj.shuixiongit.com/api',
          changeOrigin: true,
          rewrite: path => path.replace(/^\/api/, ''),
        },