Closed kloimhardt closed 5 months ago
@kloimhardt In your example I see "equire"
, what's that?
For require to work you need to quote the argument. Not sure if top level require always works, but you can also use (as a workaround): (ns foo (:require ["A"]))
or write manually:
(js/await (js/import "A"))
@borkdude The answer "Not sure if top level require always works" clarifies the issue for me. Thank you.
As explanation: My subjective expectation was that compile_string transpiles any Clojure "(require ...)" to some JS "import" statement (ignorant of the result being executable JS-code or not).
The "equire": I meant it to clarify the above subjective expectation (instead it caused confusion). Indeed, the "equire" could be replaced by any arbitrary string. This "equire" demonstrates that the word "require" (with "r") is ignored completely by compile_string whereas "equire" (without "r") is correctly transpiled as a function name.
Can this one be closed?
yes, pls. close
When cherry.embed/compile-string is called within HTML
main.js
being a CLJS advanced Shadow compiled ES6 module, the output on the console isThe expectation is that the output includes a JS
import
To reproduce issue: cherry_require.html