mirror of
https://github.com/GoogleChromeLabs/squoosh.git
synced 2025-11-12 16:57:26 +00:00
wasm-bindgen-rayon and new OMT plugin (#1007)
* WIP: wasm-bindgen-rayon and new OMT plugin * Bump package-lock * Make OMT work again * Update year * Restore accidental change * Prevent minification of `nextDefineUri` * Delay loading external deps This gives inline `define` calls a chance to define dependencies for earlier `define` calls on the same page. * Add comment
This commit is contained in:
@@ -137,10 +137,24 @@ export default function (inputOptions, outputOptions, resolveFileUrl) {
|
||||
const dependencies = getDependencies(clientOutput, clientEntry);
|
||||
|
||||
if (property.startsWith(allSrcPlaceholder)) {
|
||||
const depCodes = dependencies.map(
|
||||
(name) => clientOutput.find((item) => item.fileName === name).code,
|
||||
);
|
||||
return JSON.stringify([clientEntry.code, ...depCodes].join(';'));
|
||||
const allModules = [
|
||||
clientEntry,
|
||||
...dependencies.map((name) =>
|
||||
clientOutput.find((item) => item.fileName === name),
|
||||
),
|
||||
];
|
||||
|
||||
const inlineDefines = [
|
||||
...allModules.map(
|
||||
(item) =>
|
||||
`self.nextDefineUri=location.origin+${resolveFileUrl(item)};${
|
||||
item.code
|
||||
}`,
|
||||
),
|
||||
'self.nextDefineUri=""',
|
||||
];
|
||||
|
||||
return JSON.stringify(inlineDefines.join(''));
|
||||
}
|
||||
|
||||
return (
|
||||
|
||||
Reference in New Issue
Block a user