Nice! I can confirm using Reagent with Sci can be used for many things. I have been playing with it since last year. Back then I still ran into some issues (I was pushing it), but I think they have been solved since
Making an http request with the sci application tag =) https://github.com/borkdude/sci-script-tag/blob/ef2eb9a19097902b6c4b24de261ad4d0d8f08e0c/resources/public/tictactoe.html#L51-L60
Had a better look at how you do the plugin system. Really cool. I hope to try it with something like observablehq soon to further explore it
@jeroenvandijk I suspect that there will be some problems if plugins are developed independently (in separate projects) since the advanced compilation renaming might not work the same if you work in a fork... I haven't tested that. But it will probably work if you compile all the modules using simple
or so
Ah yeah true forgot about that
but if the plugins are all compiled from the same code base, that could work
yeah exactly still very useful. A page only needs to load the plugins it needs
I wonder how other JS projects handle this
Not sure how heavy the advanced compilation process would become with many plugins. Worth to find out 🙂
you could also try this btw
fork the script-tag project, make a plugin and see if it works with the published script-tag js
yeah good one
I don’t know enough about the compilation process but I hope it is somewhat deterministic
check the script/release.clj
script to see how to compile for release
clojure -M:dev -m shadow.cljs.devtools.cli release main
and the modules (plugins) are defined in shadow-cljs.edn
I've been investigating support for CLJS's this-as
in sci, it's a bit more difficult than I thought. How common is that these days
I don’t remember using this-as
, but i haven’t don’t much cljs lately
I wonder if :modules
or :stable-names
might be relevant for the advanced compilation of Sci modules https://clojurescript.org/reference/compiler-options#modules
i’ll look into this later
it's already using those modules
ah ok
I haven't heard about stable names... let's see
I’m probably doing something wrong (wrong shadow-clj version maybe?)
script/release.clj
Compiling CLJS
Cloning: <https://github.com/borkdude/sci>
Checking out: <https://github.com/borkdude/sci> at 02733a591bfa2f425b8abe0377d6668559ac278a
Downloading: thheller/shadow-cljs/2.12.5/shadow-cljs-2.12.5.pom from clojars
Downloading: borkdude/edamame/0.0.11/edamame-0.0.11.pom from clojars
Downloading: cljsjs/react/17.0.2-0/react-17.0.2-0.pom from clojars
Downloading: cljsjs/react-dom-server/17.0.2-0/react-dom-server-17.0.2-0.pom from clojars
Downloading: cljsjs/react-dom/17.0.2-0/react-dom-17.0.2-0.pom from clojars
Downloading: com/google/javascript/closure-compiler-unshaded/v20210302/closure-compiler-unshaded-v20210302.pom from central
Downloading: com/google/javascript/closure-compiler-main/v20210302/closure-compiler-main-v20210302.pom from central
Downloading: thheller/shadow-undertow/0.1.0/shadow-undertow-0.1.0.pom from clojars
Downloading: com/google/javascript/closure-compiler-parent/v20210302/closure-compiler-parent-v20210302.pom from central
Downloading: io/undertow/undertow-core/2.2.4.Final/undertow-core-2.2.4.Final.pom from central
Downloading: io/undertow/undertow-parent/2.2.4.Final/undertow-parent-2.2.4.Final.pom from central
Downloading: com/google/javascript/closure-compiler-unshaded/v20210302/closure-compiler-unshaded-v20210302.jar from central
Downloading: borkdude/edamame/0.0.11/edamame-0.0.11.jar from clojars
Downloading: io/undertow/undertow-core/2.2.4.Final/undertow-core-2.2.4.Final.jar from central
Downloading: cljsjs/react/17.0.2-0/react-17.0.2-0.jar from clojars
Downloading: thheller/shadow-undertow/0.1.0/shadow-undertow-0.1.0.jar from clojars
Downloading: cljsjs/react-dom-server/17.0.2-0/react-dom-server-17.0.2-0.jar from clojars
Downloading: thheller/shadow-cljs/2.12.5/shadow-cljs-2.12.5.jar from clojars
Downloading: cljsjs/react-dom/17.0.2-0/react-dom-17.0.2-0.jar from clojars
[:main] Compiling ...
The required namespace "react" is not available, it was required by "reagent/core.cljs".
[bb null] Terminating with non-zero exit code: 1
I wanted to see if my compiled output is (slightly) different than yours. If it is not i’m assuming external modules should work
you need to npm install it
What version are you using? I seem to have npm@6.14.4
shouldn't matter I think as long as it downloads the same library
I have 7.13.0
$ cat node_modules/react/package.json
{
"name": "react",
"description": "React is a JavaScript library for building user interfaces.",
"keywords": [
"react"
],
"version": "17.0.1",
Seems to not work.
I will try with :stable-names
...
hmm, :stable-names always enabled, cannot be disabled
says the shadow-cljs manual
I will try shadow-cljs release ... --debug
https://clojurians.slack.com/archives/C03S1L9DN/p1621971861272200
Perhaps :pseudo-names
could work here, although the docs suggest it's for debugging
yeah, @thheller confirmed this is not possible with advanced
compiling with :simple
yields 5mb, about 5 times as much as with :advanced
for node projects that might not be so bad @jeroenvandijk, so if you want to make a plugin system for observable, while allowing others to make plugins independently that might work
for the script tag thing I'd like to stick to advanced though
yeah makes sense. I’ll think about it some more
I've tried to make a simple try
like this
I'm getting some error
why this?