2026-04-02 11:06:57 +05:30
|
|
|
import { defineConfig } from "vite";
|
|
|
|
|
import react from "@vitejs/plugin-react";
|
2026-04-01 17:59:05 +05:30
|
|
|
import legacy from '@vitejs/plugin-legacy';
|
|
|
|
|
import esbuild from 'esbuild';
|
2026-03-23 16:08:11 +05:30
|
|
|
export default defineConfig(({ mode }) => {
|
2026-04-02 11:06:57 +05:30
|
|
|
const isProd = mode === "production";
|
2026-03-23 16:08:11 +05:30
|
|
|
|
2026-04-02 11:06:57 +05:30
|
|
|
return {
|
2026-04-10 17:41:59 +05:30
|
|
|
|
2026-04-02 11:06:57 +05:30
|
|
|
|
2026-04-10 17:41:59 +05:30
|
|
|
plugins: [react()],
|
|
|
|
|
base: isProd ? "/apps/retail/" : "/", //for capcitor base: isProd ? "/" : "/",
|
|
|
|
|
|
2026-04-02 11:06:57 +05:30
|
|
|
envDir: "src",
|
|
|
|
|
envPrefix: "ENV_",
|
2026-03-23 16:08:11 +05:30
|
|
|
|
2026-04-02 11:06:57 +05:30
|
|
|
server: {
|
|
|
|
|
host: true, // 🔥 auto detect your IP
|
|
|
|
|
port: process.env.PORT || 3015,
|
2026-03-23 16:08:11 +05:30
|
|
|
},
|
|
|
|
|
|
|
|
|
|
build: {
|
2026-04-10 17:41:59 +05:30
|
|
|
target: "chrome83",
|
|
|
|
|
chunkSizeWarningLimit: 1000,
|
2026-04-02 11:06:57 +05:30
|
|
|
minify: "esbuild",
|
2026-04-10 17:41:59 +05:30
|
|
|
rollupOptions: {
|
|
|
|
|
external: ['/capacitor.js', '/cordova.js', '/native-bridge.js']
|
|
|
|
|
},
|
2026-03-23 16:08:11 +05:30
|
|
|
esbuild: {
|
2026-04-02 11:06:57 +05:30
|
|
|
drop: isProd ? ["console", "debugger"] : [],
|
2026-03-05 17:31:46 +05:30
|
|
|
},
|
2026-03-23 16:08:11 +05:30
|
|
|
},
|
2026-04-02 11:06:57 +05:30
|
|
|
};
|
|
|
|
|
});
|