From a7a4fce52e4e21276f2ab11fb17e20f8580864ec Mon Sep 17 00:00:00 2001 From: Michiel Borkent Date: Thu, 7 Nov 2024 18:28:20 +0100 Subject: [PATCH] wip --- src/nbb/core.cljs | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-) diff --git a/src/nbb/core.cljs b/src/nbb/core.cljs index 2389ce7..9a3b01a 100644 --- a/src/nbb/core.cljs +++ b/src/nbb/core.cljs @@ -146,18 +146,16 @@ ((.-resolve (:require @ctx)) libname)))) (js/Promise.resolve ((.-resolve (:require @ctx)) libname))) (.then (fn [path] - (let [file (if (str/starts-with? path "file:") - (url/fileURLToPath path) - path) - file? (delay (fs/existsSync file)) - path* (if (and reload? + ;; (prn :path path) + (let [file-url (if (str/starts-with? path "file:") + path + (when (fs/existsSync path) + (url/pathToFileURL path))) + path (if (and reload? ;; not "node:fs" etc - @file?) - (str file "?uuid=" (random-uuid)) - path) - path (if (and windows? @file?) - (str (url/pathToFileURL path*)) - path*)] + file-url) + (str file-url "?uuid=" (random-uuid)) + path)] (esm/dynamic-import path)))) (.then (fn [mod] (register-module mod internal-name)