mirror of
https://github.com/GoogleChromeLabs/squoosh.git
synced 2025-11-14 09:39:15 +00:00
Cache correct assets (#887)
* Cache correct assets * Update lib/entry-data-plugin.js Co-authored-by: Surma <surma@surma.dev> * Actually commit the fix this time Co-authored-by: Surma <surma@surma.dev>
This commit is contained in:
@@ -10,7 +10,7 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
import webpDecoder, { WebPModule } from 'codecs/webp/dec/webp_dec';
|
||||
import type { WebPModule } from 'codecs/webp/dec/webp_dec';
|
||||
import wasmUrl from 'url:codecs/webp/dec/webp_dec.wasm';
|
||||
import { initEmscriptenModule, blobToArrayBuffer } from 'features/worker-utils';
|
||||
|
||||
@@ -18,7 +18,8 @@ let emscriptenModule: Promise<WebPModule>;
|
||||
|
||||
export default async function decode(blob: Blob): Promise<ImageData> {
|
||||
if (!emscriptenModule) {
|
||||
emscriptenModule = initEmscriptenModule(webpDecoder, wasmUrl);
|
||||
const decoder = await import('codecs/webp/dec/webp_dec');
|
||||
emscriptenModule = initEmscriptenModule(decoder.default, wasmUrl);
|
||||
}
|
||||
|
||||
const [module, data] = await Promise.all([
|
||||
|
||||
Reference in New Issue
Block a user