| 
									
										
										
										
											2023-01-17 18:31:51 +01:00
										 |  |  | import { defineConfig } from "vite" | 
					
						
							|  |  |  | import { svelte } from "@sveltejs/vite-plugin-svelte" | 
					
						
							| 
									
										
										
										
											2023-01-17 03:37:26 +01:00
										 |  |  | import fs from "fs" | 
					
						
							| 
									
										
										
										
											2024-01-15 01:54:09 +01:00
										 |  |  | import basicSsl from '@vitejs/plugin-basic-ssl' | 
					
						
							| 
									
										
										
										
											2023-01-17 18:31:51 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-01-17 03:37:26 +01:00
										 |  |  | const allHtmlFiles = fs.readdirSync(".").filter((f) => f.endsWith(".html")) | 
					
						
							|  |  |  | const input = {} | 
					
						
							| 
									
										
										
										
											2023-01-17 18:49:15 +01:00
										 |  |  | const ASSET_URL = process.env.ASSET_URL || "" | 
					
						
							| 
									
										
										
										
											2023-01-17 03:37:26 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  | for (const html of allHtmlFiles) { | 
					
						
							|  |  |  |   const name = html.substring(0, html.length - 5) | 
					
						
							|  |  |  |   input[name] = "./" + html | 
					
						
							|  |  |  | } | 
					
						
							| 
									
										
										
										
											2024-01-15 01:54:09 +01:00
										 |  |  | console.log("Args:",process.argv) | 
					
						
							|  |  |  | const plugins = [svelte() ] | 
					
						
							|  |  |  | if(process.argv.indexOf("--https") >= 0){ | 
					
						
							|  |  |  |   console.log("Adding basicSSL") | 
					
						
							|  |  |  |   plugins.push(basicSsl()) | 
					
						
							|  |  |  | } | 
					
						
							| 
									
										
										
										
											2023-01-17 18:31:51 +01:00
										 |  |  | export default defineConfig({ | 
					
						
							| 
									
										
										
										
											2023-01-17 03:37:26 +01:00
										 |  |  |   build: { | 
					
						
							|  |  |  |     rollupOptions: { | 
					
						
							|  |  |  |       input, | 
					
						
							|  |  |  |     }, | 
					
						
							|  |  |  |   }, | 
					
						
							| 
									
										
										
										
											2023-01-17 18:49:15 +01:00
										 |  |  |   base: `${ASSET_URL}`, | 
					
						
							| 
									
										
										
										
											2024-01-15 01:54:09 +01:00
										 |  |  |   plugins , | 
					
						
							| 
									
										
										
										
											2023-01-17 03:44:38 +01:00
										 |  |  |   server: { | 
					
						
							|  |  |  |     port: 1234, | 
					
						
							|  |  |  |   }, | 
					
						
							| 
									
										
										
										
											2023-01-17 03:37:26 +01:00
										 |  |  | }) |