Skip to content

Commit 8c0ebc3

Browse files
committed
Fix asset paths for GitHub Pages deployment
- Use relative path for coi-serviceworker.js - Fix WASM paths to use worker's base path
1 parent 435f913 commit 8c0ebc3

2 files changed

Lines changed: 11 additions & 4 deletions

File tree

index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
<meta name="description" content="RayLens - Browser-first analytical application built on RayforceDB" />
88
<title>RayLens</title>
99
<!-- Enable SharedArrayBuffer on GitHub Pages via service worker -->
10-
<script src="coi-serviceworker.js"></script>
10+
<script src="./coi-serviceworker.js"></script>
1111
<!-- Preload fonts -->
1212
<link rel="preconnect" href="https://fonts.googleapis.com" />
1313
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />

src/workers/rayforce.worker.ts

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -92,9 +92,16 @@ async function handleInit(): Promise<void> {
9292
try {
9393
console.log('[Worker] Initializing Rayforce WASM...');
9494

95-
const jsUrl = new URL('/rayforce/rayforce.js', self.location.origin).href;
96-
const sdkUrl = new URL('/rayforce/rayforce.sdk.js', self.location.origin).href;
97-
const wasmUrl = new URL('/rayforce/rayforce.wasm', self.location.origin).href;
95+
// Get base path from worker location (handles GitHub Pages subpath)
96+
const workerUrl = new URL(self.location.href);
97+
const basePath = workerUrl.pathname.replace(/\/assets\/.*$/, '');
98+
99+
const jsUrl = `${workerUrl.origin}${basePath}/rayforce/rayforce.js`;
100+
const sdkUrl = `${workerUrl.origin}${basePath}/rayforce/rayforce.sdk.js`;
101+
const wasmUrl = `${workerUrl.origin}${basePath}/rayforce/rayforce.wasm`;
102+
103+
console.log('[Worker] Base path:', basePath);
104+
console.log('[Worker] WASM URL:', wasmUrl);
98105

99106
// Fetch and patch the WASM loader
100107
const response = await fetch(jsUrl);

0 commit comments

Comments
 (0)