无人机管理后台前端(已迁走)
rjg
2025-04-10 438d0bc0af2372f5068e590244cb237903d0f6f4
fix:update
1 files modified
61 ■■■■■ changed files
vite.config.mjs 61 ●●●●● patch | view | raw | blame | history
vite.config.mjs
@@ -19,7 +19,6 @@
    // 判断是打生产环境包
    const isProd = VITE_APP_ENV === 'production'
<<<<<<< HEAD
  // 根据是否生产环境,动态设置压缩配置
  const buildConfig = {
    outDir: 'manage',
@@ -69,63 +68,7 @@
    },
    plugins: createVitePlugins(env, command === 'build'),
    build: buildConfig,
    optimizeDeps: {
      esbuildOptions: {
=======
    // 根据是否生产环境,动态设置压缩配置
    const buildConfig = {
        outDir: 'manage',
>>>>>>> 126bde584b7a925650df0183325cff5094bd8ac3
        target: 'esnext',
        minify: isProd ? 'terser' : 'esbuild', // 根据环境选择压缩工具
    }
    // 如果是生产环境,添加Terser的配置
    if (isProd) {
        buildConfig.terserOptions = {
            compress: {
                drop_console: true, // 删除 console
                drop_debugger: true, // 删除 debugger
            },
            format: {
                comments: false, // 删除所有注释
            },
        }
    }
    return defineConfig({
        base: VITE_APP_BASE,
        define: {
            __VUE_I18N_FULL_INSTALL__: true,
            __VUE_I18N_LEGACY_API__: true,
            __INTLIFY_PROD_DEVTOOLS__: false,
        },
        server: {
            // port: 2888,
            // host: '192.168.1.178',
            proxy: {
                '/api': {
                    // target: 'http://localhost',
                    target: VITE_APP_URL,
                    changeOrigin: true,
                    rewrite: path => path.replace(/^\/api/, ''),
                },
            },
        },
        resolve: {
            alias: {
                '~': resolve(__dirname, './'),
                '@': resolve(__dirname, './src'),
                components: resolve(__dirname, './src/components'),
                styles: resolve(__dirname, './src/styles'),
                utils: resolve(__dirname, './src/utils'),
            },
        },
        plugins: createVitePlugins(env, command === 'build'),
        build: buildConfig,
        optimizeDeps: {
            esbuildOptions: {
                target: 'esnext',
            },
        },
    })
}