forked from jsnbuchanan/crowd-funder-for-time-pwa
- Add src/main.ts as dynamic entry point that loads platform-specific code - Update index.html to use dynamic main.ts instead of hardcoded main.web.ts - Remove external capacitor config from vite.config.common.mts to ensure proper bundling - Enables consistent platform detection across all build targets - Use proper logger utility instead of console.log for platform detection logging
27 lines
853 B
TypeScript
27 lines
853 B
TypeScript
/**
|
|
* @file Dynamic Main Entry Point
|
|
* @author Matthew Raymer
|
|
*
|
|
* This file dynamically loads the appropriate platform-specific main entry point
|
|
* based on the current environment and build configuration.
|
|
*/
|
|
|
|
import { logger } from "./utils/logger";
|
|
|
|
// Check the platform from environment variables
|
|
const platform = process.env.VITE_PLATFORM || "web";
|
|
|
|
logger.info(`[Main] 🚀 Loading TimeSafari for platform: ${platform}`);
|
|
|
|
// Dynamically import the appropriate main entry point
|
|
if (platform === "capacitor") {
|
|
logger.info(`[Main] 📱 Loading Capacitor-specific entry point`);
|
|
import("./main.capacitor");
|
|
} else if (platform === "electron") {
|
|
logger.info(`[Main] 💻 Loading Electron-specific entry point`);
|
|
import("./main.electron");
|
|
} else {
|
|
logger.info(`[Main] 🌐 Loading Web-specific entry point`);
|
|
import("./main.web");
|
|
}
|