mirror of
https://github.com/GoogleChromeLabs/squoosh.git
synced 2025-11-12 00:37:19 +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 = {};
|
let registry = {};
|
||||||
|
|
||||||
const singleRequire = (uri, parentUri) => {
|
const singleRequire = (uri, parentUri) => {
|
||||||
let origURI = uri;
|
uri = uri.startsWith(location.origin) ? uri : new URL(uri + ".js", parentUri).href;
|
||||||
uri = new URL(uri + ".js", parentUri).href;
|
|
||||||
return registry[uri] || (
|
return registry[uri] || (
|
||||||
<% if (useEval) { %>
|
<% if (useEval) { %>
|
||||||
fetch(uri)
|
fetch(uri)
|
||||||
|
|||||||
Reference in New Issue
Block a user