nbb icon indicating copy to clipboard operation
nbb copied to clipboard

config.edn with script argument doesn't seem to work

Open logseq-cldwalker opened this issue 2 years ago • 0 comments

Hi. Trying out the latest --config functionality and ~~not sure if I'm doing something wrong~~ I think there's a race condition /cc @lilactown


version

0.7.132

platform

osx 12.0.1

problem

Use --config with a script file and see that nbb is unable to load the dependency ns

repro

nbb --config malli.edn malli.cljs
----- Error --------------------------------------
Message:  Could not find namespace: malli.core
Could not find namespace: malli.core

malli.edn:

{:deps {metosin/malli {:git/url "https://github.com/borkdude/malli" :git/sha "e400bbcdab09b21dc42d82f90400f60f85af6bd9"}}}

malli.cljs:

(ns malli
  (:require [malli.core :as m]))

(def non-empty-string
  (m/schema [:string {:min 1}]))

(prn (m/validate non-empty-string ""))
(prn (m/validate non-empty-string "kikka"))

EDIT: If I put (nbb.core/await (js/Promise. (fn [r] (js/setTimeout r 100)))) before the ns declaration. I no longer see the issue. There seems to be a race condition

expected behavior

Expected to see results as I see them in the repl:

nbb --config malli.edn
Welcome to nbb v0.7.132!
user=> (require '[malli])
false
true
nil

logseq-cldwalker avatar Aug 12 '22 16:08 logseq-cldwalker