diff --git a/electron/main.js b/electron/main.js
index b39a9e65..e9bc8606 100644
--- a/electron/main.js
+++ b/electron/main.js
@@ -1,4 +1,4 @@
-import { app, BrowserWindow, ipcMain, shell, Menu } from 'electron';
+import { app, BrowserWindow, ipcMain, shell, Menu, protocol } from 'electron';
import { spawn } from 'child_process';
import path from 'path';
import { fileURLToPath } from 'url';
@@ -42,9 +42,9 @@ function createWindow() {
mainWindow.loadURL('http://localhost:5173');
mainWindow.webContents.openDevTools();
} else {
- // Production mode - load from built files
- // Use file:// protocol for proper asset loading
- mainWindow.loadURL(`file://${path.join(__dirname, '../dist/index.html')}`);
+ // Production mode - load from custom protocol
+ // This allows absolute paths like /shakespeare.svg to work naturally
+ mainWindow.loadURL('app://index.html');
}
// Handle window close
@@ -66,6 +66,28 @@ async function ensureShakespeareRoot() {
// This method will be called when Electron has finished
// initialization and is ready to create browser windows.
app.whenReady().then(async () => {
+ // Register the app:// protocol to serve files from dist/
+ // This allows absolute paths (/) to work naturally without base: './'
+ protocol.registerFileProtocol('app', (request, callback) => {
+ // Remove 'app://' prefix and normalize path
+ let filePath = request.url.replace('app://', '');
+
+ // Handle root path
+ if (filePath === '' || filePath === '/') {
+ filePath = 'index.html';
+ }
+
+ // Remove leading slash if present
+ if (filePath.startsWith('/')) {
+ filePath = filePath.substring(1);
+ }
+
+ // Resolve to dist directory
+ const fullPath = path.join(__dirname, '../dist', filePath);
+
+ callback({ path: fullPath });
+ });
+
// Ensure Shakespeare root directory exists before creating window
await ensureShakespeareRoot();
diff --git a/src/components/AppShowcaseCard.tsx b/src/components/AppShowcaseCard.tsx
index 4411f604..830a584c 100644
--- a/src/components/AppShowcaseCard.tsx
+++ b/src/components/AppShowcaseCard.tsx
@@ -2,7 +2,6 @@ import React, { useState } from 'react';
import { Link } from 'react-router-dom';
import { Button } from '@/components/ui/button';
import { Card, CardContent } from '@/components/ui/card';
-import badgeSvg from '/badge.svg';
import {
ExternalLink,
Edit,
@@ -568,7 +567,7 @@ export function AppShowcaseCard({ app, onEdit, showModerationControls, hideAppro
className="flex-1"
>
diff --git a/src/components/ShakespeareLogo.tsx b/src/components/ShakespeareLogo.tsx
index ab7694d5..f71920f5 100644
--- a/src/components/ShakespeareLogo.tsx
+++ b/src/components/ShakespeareLogo.tsx
@@ -1,5 +1,3 @@
-import shakespeareLogo from '/shakespeare.svg';
-
export interface ShakespeareLogoProps {
className?: string;
}
@@ -7,7 +5,7 @@ export interface ShakespeareLogoProps {
export function ShakespeareLogo({ className }: ShakespeareLogoProps) {
return (
diff --git a/vite.config.ts b/vite.config.ts
index 21b2edc2..09442e9c 100644
--- a/vite.config.ts
+++ b/vite.config.ts
@@ -18,7 +18,6 @@ function getVersion(): string {
// https://vitejs.dev/config/
export default defineConfig(() => ({
- base: './', // Use relative paths for assets (required for Electron)
server: {
host: "::",
port: 8080,