import { defineConfig, loadEnv } from 'vite' import vue from '@vitejs/plugin-vue' import { lazyImport, VxeResolver } from 'vite-plugin-lazy-import' import legacy from '@vitejs/plugin-legacy' import path from 'path' // https://vite.dev/config/ export default defineConfig(({ mode }) => { const env = loadEnv(mode, process.cwd()) console.log('当前环境:', mode) console.log('当前环境变量:', env) return { esbuild: { supported: { bigint: true } }, plugins: [ vue(), legacy({ targets: ['defaults', 'not IE 11', 'chrome >=73'], modernPolyfills: true }), lazyImport({ resolvers: [ VxeResolver({ libraryName: 'vxe-table' }), VxeResolver({ libraryName: 'vxe-pc-ui' }) ] }) ], resolve: { alias: { '@': path.resolve(__dirname, './src') } }, base: process.env.NODE_ENV === 'production' ? './' : '/' } })