Skip to content

Commit 3ca4bfb

Browse files
Geoff Smithclaude
andcommitted
Fix asset fetch paths for GitHub Pages subpath deployment
Use import.meta.env.BASE_URL instead of hardcoded '/' for fetching workflow JSON and tooltips from public/. Vite sets this to '/comfy-webui/' in production builds, resolving 404s on GitHub Pages. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 6d7baa5 commit 3ca4bfb

3 files changed

Lines changed: 3 additions & 3 deletions

File tree

‎src/components/Tooltip.jsx‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ let tooltipFetchPromise = null;
88
function loadTooltips() {
99
if (tooltipCache) return Promise.resolve(tooltipCache);
1010
if (tooltipFetchPromise) return tooltipFetchPromise;
11-
tooltipFetchPromise = fetch('/tooltips.json')
11+
tooltipFetchPromise = fetch(`${import.meta.env.BASE_URL}tooltips.json`)
1212
.then((res) => res.json())
1313
.then((data) => {
1414
tooltipCache = data;

‎src/services/mfs-workflow-builder.js‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ let cachedWorkflow = null;
1212
*/
1313
export async function loadMFSWorkflow() {
1414
if (cachedWorkflow) return cachedWorkflow;
15-
const response = await fetch('/medium_format_studio_api.json');
15+
const response = await fetch(`${import.meta.env.BASE_URL}medium_format_studio_api.json`);
1616
if (!response.ok) {
1717
throw new Error(`Failed to load MFS workflow: ${response.status}`);
1818
}

‎src/services/workflow-loader.js‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import { NODE_IDS } from '../utils/constants';
77
export async function loadWorkflow() {
88
try {
99
// Use API format workflow (not frontend format)
10-
const response = await fetch('/image_flux2_klein_text_to_image_api.json');
10+
const response = await fetch(`${import.meta.env.BASE_URL}image_flux2_klein_text_to_image_api.json`);
1111
if (!response.ok) {
1212
throw new Error(`HTTP error! status: ${response.status}`);
1313
}

0 commit comments

Comments
 (0)