From b97ec5a2f6e3001a9f9d5e4d12e13d058b857df4 Mon Sep 17 00:00:00 2001 From: gudzpoz Date: Tue, 31 Oct 2023 14:06:10 +0800 Subject: [PATCH] Fix patch version in unpkg url --- src/factory.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/factory.ts b/src/factory.ts index 48c0d50..466a557 100755 --- a/src/factory.ts +++ b/src/factory.ts @@ -14,8 +14,8 @@ export default class LuaFactory { (typeof self === 'object' && self?.constructor?.name === 'DedicatedWorkerGlobalScope') if (isBrowser) { - const majorminor = version.slice(0, version.lastIndexOf('.')) - customWasmUri = `https://unpkg.com/wasmoon@${majorminor}/dist/glue.wasm` + const stem = /^(\d+\.\d+(?:\.\d+)?)/.exec(version) + customWasmUri = `https://unpkg.com/wasmoon@${stem ? stem[1] : version}/dist/glue.wasm` } }