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:
Jake Archibald
2020-12-09 12:20:14 +00:00
committed by GitHub
parent fec826b106
commit 9062a75541
9 changed files with 330 additions and 78 deletions

View File

@@ -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([