From 012652cc79137853fb97e7867c244d6764aeb0ec Mon Sep 17 00:00:00 2001 From: Mark Lundin Date: Mon, 2 Dec 2024 15:11:50 +0000 Subject: [PATCH] Refactor script loading logic in ScriptHandler --- src/framework/handlers/script.js | 16 ++-------------- 1 file changed, 2 insertions(+), 14 deletions(-) diff --git a/src/framework/handlers/script.js b/src/framework/handlers/script.js index fde854c1cb4..1bd2666719e 100644 --- a/src/framework/handlers/script.js +++ b/src/framework/handlers/script.js @@ -77,23 +77,11 @@ class ScriptHandler extends ResourceHandler { }); // check if we're loading a module or a classic script - const [basePath, search] = url.load.split('?'); + const [basePath] = url.load.split('?'); const isEsmScript = basePath.endsWith('.mjs'); if (isEsmScript) { - - // The browser will hold its own cache of the script, so we need to bust it - let path = url.load; - if (path.startsWith(this._app.assets.prefix)) { - path = path.replace(this._app.assets.prefix, ''); - } - - const hash = this._app.assets.getByUrl(path).file.hash; - const searchParams = new URLSearchParams(search); - searchParams.set('hash', hash); - const urlWithHash = `${basePath}?${searchParams.toString()}`; - - this._loadModule(urlWithHash, onScriptLoad); + this._loadModule(basePath, onScriptLoad); } else { this._loadScript(url.load, onScriptLoad); }