36 lines
903 B
TypeScript
36 lines
903 B
TypeScript
import react from '@vitejs/plugin-react'
|
|
import { defineConfig, loadEnv } from 'vite'
|
|
|
|
// https://vitejs.dev/config/
|
|
export default defineConfig(({ mode }) => {
|
|
const env = loadEnv(mode, process.cwd(), '')
|
|
|
|
return {
|
|
base: env.PUBLIC_PATH || '/',
|
|
resolve: { tsconfigPaths: true },
|
|
optimizeDeps: { exclude: [] },
|
|
define: {
|
|
__APP_ENV__: env.APP_ENV,
|
|
APP_VERSION: JSON.stringify(process.env.npm_package_version)
|
|
},
|
|
build: {
|
|
target: 'es2020',
|
|
minify: 'oxc',
|
|
sourcemap: mode !== 'production',
|
|
outDir: 'build',
|
|
chunkSizeWarningLimit: 1600,
|
|
rolldownOptions: { output: { comments: { legal: false } } }
|
|
},
|
|
server: {
|
|
watch: {
|
|
usePolling: true
|
|
},
|
|
host: true,
|
|
strictPort: true,
|
|
port: 8000,
|
|
proxy: env.PROXY_URL ? { '/api': env.PROXY_URL } : undefined
|
|
},
|
|
plugins: [react()]
|
|
}
|
|
})
|