From 9e5750808626347fd4c5bb04c8c13ef18549bd80 Mon Sep 17 00:00:00 2001 From: Kevin Cooney Date: Sat, 18 Jan 2025 16:21:22 -0800 Subject: [PATCH] scriptPath() should not fail when menu.js is included in a bundle. Since import.meta.url is a runtime feature, it will not exist if the menu.js code is bundled. This change updates scriptPath() to check if import.meta.url exists before trying to dereferencing it, enabling the calculation of options.path to fallback to 'plugin/menu/'. --- plugin.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugin.js b/plugin.js index b7939e5..7095c1f 100644 --- a/plugin.js +++ b/plugin.js @@ -30,7 +30,7 @@ const Plugin = () => { if (sel) { path = sel.src.slice(0, -7); } - } else { + } else if ('url' in import.meta) { path = import.meta.url.slice(0, import.meta.url.lastIndexOf('/') + 1); }