fix: editor loader built a protocol-relative URL on standard installs

The base-prefix computation produced '//' when the loader is served
from the top-level /extensions mount (the standard case), turning the
editor import into '//<pack>/index.js'. Browsers parse that as a
protocol-relative URL and resolve '<pack>' as a DNS hostname, so the
editor entry never loaded: console shows 'Failed to load resource:
net::ERR_NAME_NOT_RESOLVED  moxie-multimedia/index.js' followed by
[vite:preloadError]. Only sub-path reverse-proxy deployments
accidentally worked. Base is now exactly '/' when there is no
sub-path prefix, and '<prefix>/' otherwise.
This commit is contained in:
Z User 2026-09-29 04:57:25 +00:00
parent 0a6a5d6aa9
commit bac3101e4d

View File

@ -39,8 +39,12 @@ if (!packName) {
} else {
// Base prefix covers deployments behind a sub-path reverse proxy
// ("/comfyui/extensions/<pack>/..." -> "/comfyui/"); the pack's own
// static mount sits at "<base><pack>/".
const base = '/' + segments.slice(0, extensionsIndex).join('/') + '/';
// static mount sits at "<base><pack>/". For the standard deployment
// there is no prefix and base is exactly "/" - it must NEVER be "//",
// which the browser would parse as a protocol-relative URL and try to
// resolve "<pack>" as a DNS hostname (net::ERR_NAME_NOT_RESOLVED).
const prefix = segments.slice(0, extensionsIndex);
const base = prefix.length ? '/' + prefix.join('/') + '/' : '/';
// Top-level await: extension scripts are awaited before ComfyUI registers
// node definitions, so the editor's registerExtension()/custom-widget
// hooks stay in the normal loading order.