-
Today I'm trying to use squint from ClojureScript:
Nice.
Cool.
Alright. cljs.user=> (require '["squint-cljs" :as squint])
[2023-12-17 16:11:51.138 - WARNING] :shadow.cljs.devtools.server.worker.impl/cljs-compile-ex - {:input {:code "(require '[\"squint-cljs\" :as squint])", :ns cljs.user, :repl true}}
ExceptionInfo Failed to process REPL command {:eof? false, :ns cljs.user, :form (require (quote ["squint-cljs" :as squint])), :source "(require '[\"squint-cljs\" :as squint])", :tag :shadow.cljs.repl/process-ex}
shadow.cljs.repl/process-read-result (repl.clj:576)
shadow.cljs.repl/process-read-result (repl.clj:550)
shadow.cljs.repl/process-input (repl.clj:713)
shadow.cljs.repl/process-input (repl.clj:691)
shadow.cljs.devtools.server.worker.impl/fn--15693 (impl.clj:698)
shadow.cljs.devtools.server.worker.impl/fn--15693 (impl.clj:688)
clojure.lang.MultiFn.invoke (MultiFn.java:234)
shadow.cljs.devtools.server.util/server-thread/fn--15367/fn--15368/fn--15376 (util.clj:283)
shadow.cljs.devtools.server.util/server-thread/fn--15367/fn--15368 (util.clj:282)
shadow.cljs.devtools.server.util/server-thread/fn--15367 (util.clj:255)
java.lang.Thread.run (Thread.java:829)
Caused by:
ExceptionInfo closure errors {:tag :shadow.build.closure/errors, :errors [{:resource-name "node_modules/squint-cljs/lib/compiler.js", :source-name "node_modules/squint-cljs/lib/compiler.js", :line 16, :column 9, :msg "Dynamic import expressions cannot be transpiled."}]}
shadow.build.closure/throw-errors! (closure.clj:1294)
shadow.build.closure/throw-errors! (closure.clj:1288)
shadow.build.closure/convert-sources-simple* (closure.clj:2098)
shadow.build.closure/convert-sources-simple* (closure.clj:1944)
shadow.build.closure/convert-sources-simple (closure.clj:2254)
shadow.build.closure/convert-sources-simple (closure.clj:2204)
shadow.build.compiler/maybe-closure-convert (compiler.clj:1252)
shadow.build.compiler/maybe-closure-convert (compiler.clj:1245)
shadow.build.compiler/compile-all (compiler.clj:1501)
shadow.build.compiler/compile-all (compiler.clj:1364)
shadow.build.api/compile-sources (api.clj:261)
shadow.build.api/compile-sources (api.clj:253)
------ REPL Error while processing ---------------------------------------------
(require '["squint-cljs" :as squint])
Closure compilation failed with 1 errors
--- node_modules/squint-cljs/lib/compiler.js:16
Dynamic import expressions cannot be transpiled. Now, some searching has lead me to believe that this is a limitation of the google closure compiler. Does what I'm trying make sense? Did I do something wrong? It would be neat to use squint in the browser from ClojureScript. Thanks in advance for your time, consideration, and thoughts. |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 10 replies
-
With shadow-cljs you must use |
Beta Was this translation helpful? Give feedback.
-
Using it directly from cljs will be the next thing I try - sorry I didn't realize that was possible (was thinking too hard about js).
Oops! Sorry again, I'm sure this is confusing to you - I'm actually doing like 3 things at once that all happen to overlap w/ your libraries, possibly. This one in particular is fun - I run an after school program where I teach kids computational creativity. I've had an idea for a while of a webpage environment where kids could interactively write code and build and learn things. Inspired by squeak/smalltalk, old LOGO systems, &c... I got excited when I saw your playground and the confetti and whatnot, since it's similar-ish to what I had in mind, and started investigating this codemirror + squint pathway. This one is an after-work-hours/hobby project, so progress will be in fits and starts. Thanks, as ever, for everything you do, it's genuinely appreciated and I look forward to continuing to consume/contribute. (: |
Beta Was this translation helpful? Give feedback.
If you would like to use the squint compiler from a shadow project, it might be better to load it as a ClojureScript library with: