diff --git a/index.html b/index.html index d2ce14a5..d276108b 100644 --- a/index.html +++ b/index.html @@ -11,6 +11,6 @@
- + diff --git a/src/main.ts b/src/main.ts new file mode 100644 index 00000000..a58becb7 --- /dev/null +++ b/src/main.ts @@ -0,0 +1,26 @@ +/** + * @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"); +} diff --git a/vite.config.common.mts b/vite.config.common.mts index 198f6ba3..848b3b9c 100644 --- a/vite.config.common.mts +++ b/vite.config.common.mts @@ -8,7 +8,6 @@ import { fileURLToPath } from 'url'; // Load environment variables dotenv.config({ path: `.env.${process.env.NODE_ENV}` }) - const __filename = fileURLToPath(import.meta.url); const __dirname = path.dirname(__filename); @@ -36,9 +35,6 @@ export async function createBuildConfig(platform: string): Promise { assetsDir: 'assets', chunkSizeWarningLimit: 1000, rollupOptions: { - external: isNative - ? ['@capacitor/app'] - : [], output: { format: 'esm', generatedCode: {