diff --git a/packages/rspack/hot/lazy-compilation-web.js b/packages/rspack/hot/lazy-compilation-web.js index b4a1d1ec4710..14e191962e24 100644 --- a/packages/rspack/hot/lazy-compilation-web.js +++ b/packages/rspack/hot/lazy-compilation-web.js @@ -5,6 +5,14 @@ if (typeof EventSource !== "function") { } var urlBase = decodeURIComponent(__resourceQuery.slice(1)); +if ( + !urlBase.startsWith("http") && + !urlBase.startsWith("//") && + typeof __rspack_dev_server_uri !== "undefined" +) { + urlBase = __rspack_dev_server_uri + urlBase; +} + /** @type {EventSource | undefined} */ var activeEventSource; var compiling = new Set();