Skip to content

Commit 48af744

Browse files
committed
Init Wasm module only once in browsers
1 parent 0cc21e8 commit 48af744

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

wasm/index.mjs

+2
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ import { await_promise_sync, createBundleAsync } from './async.mjs';
44
let wasm, bundleAsyncInternal;
55

66
export default async function init(input) {
7+
if (wasm) return;
8+
79
input = input ?? new URL('lightningcss_node.wasm', import.meta.url);
810
if (typeof input === 'string' || (typeof Request === 'function' && input instanceof Request) || (typeof URL === 'function' && input instanceof URL)) {
911
input = fetchOrReadFromFs(input);

0 commit comments

Comments
 (0)