You can not select more than 25 topics
			Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
		
		
		
		
		
			
		
			
				
					
					
						
							62 lines
						
					
					
						
							1.4 KiB
						
					
					
				
			
		
		
		
			
			
			
				
					
				
				
					
				
			
		
		
	
	
							62 lines
						
					
					
						
							1.4 KiB
						
					
					
				| import { defineConfig } from "vite"; | |
| import { VitePWA } from "vite-plugin-pwa"; | |
| import vue from "@vitejs/plugin-vue"; | |
| import dotenv from "dotenv"; | |
| import { loadAppConfig } from "./vite.config.utils"; | |
| import path from "path"; | |
| 
 | |
| // Load environment variables from .env file | |
| dotenv.config(); | |
| 
 | |
| // Load application configuration | |
| const appConfig = loadAppConfig(); | |
| 
 | |
| export default defineConfig(({ mode }) => { | |
|   const isElectron = mode === "electron"; | |
|   const isCapacitor = mode === "capacitor"; | |
| 
 | |
|   // Set output directory based on build mode | |
|   const outDir = isElectron | |
|     ? "dist-electron/www" | |
|     : isCapacitor | |
|       ? "dist-capacitor" | |
|       : "dist"; | |
| 
 | |
|   return { | |
|     base: isElectron ? "./" : "/", | |
|     server: { | |
|       port: process.env.VITE_PORT || 8080, | |
|     }, | |
|     build: { | |
|       outDir, | |
|       rollupOptions: { | |
|         ...(isElectron && { | |
|           input: { | |
|             index: path.resolve(__dirname, 'index.html') | |
|           }, | |
|           output: { | |
|             dir: outDir, | |
|             format: 'cjs', | |
|             entryFileNames: 'assets/[name].[hash].js', | |
|             chunkFileNames: 'assets/[name].[hash].js', | |
|             assetFileNames: 'assets/[name].[hash][extname]' | |
|           } | |
|         }) | |
|       } | |
|     }, | |
|     plugins: [ | |
|       vue(), | |
|       ...(isElectron | |
|         ? [] | |
|         : [ | |
|             VitePWA({ | |
|               ...appConfig.pwaConfig, | |
|               disable: isElectron | |
|             }), | |
|           ]), | |
|     ], | |
|     resolve: { | |
|       alias: appConfig.aliasConfig, | |
|     }, | |
|   }; | |
| });
 | |
| 
 |