mirror of
https://github.com/GoogleChromeLabs/squoosh.git
synced 2025-11-11 16:26:20 +00:00
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).
This commit is contained in:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user