From 10c508249996d28ff9a62ff86b969907bd4d5c9b Mon Sep 17 00:00:00 2001 From: Ingvar Stepanyan Date: Thu, 13 May 2021 15:48:23 +0100 Subject: [PATCH] Add back a loader customization for full URL (#1016) Emscripten uses dynamic `import(fullUrlOfTheMainJS)` in generated Workers. It appears that upstream rollup-plugin-off-main-thread never handled this correctly, but we had a customization in Squoosh loader template that allowed those anyway, which I removed together with most other customizations in #1007, thus breaking Emscripten codecs. This adds a hotfix back, but we need to fix this properly upstream too (TBD separately). --- lib/omt.ejs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/lib/omt.ejs b/lib/omt.ejs index fabca564..93c5a484 100644 --- a/lib/omt.ejs +++ b/lib/omt.ejs @@ -16,8 +16,7 @@ if (!self.<%- amdFunctionName %>) { let registry = {}; const singleRequire = (uri, parentUri) => { - let origURI = uri; - uri = new URL(uri + ".js", parentUri).href; + uri = uri.startsWith(location.origin) ? uri : new URL(uri + ".js", parentUri).href; return registry[uri] || ( <% if (useEval) { %> fetch(uri)