Open Peeja opened 7 years ago
Thanks for reporting - when I update the template to point to a newer cljs I'll add in a default :main
(or default to :simple
).
As far as your attempt to fix it, I haven't seen this specific issue, though I've previously had issues with the compiler being weird about symbols being used for the namespace passed to :main
instead of strings.
I can take a look at the project if that's helpful.
Ah, :simple
works great! Thanks.
Adding :main
works also for :none
in 1.9.854
. Weird that we need it though, I guess compiling for lambda was not considered as use case in ClojureScript compiler :smile:
hmm when I added :main :simple, the build worked but then I got:
2017-10-06T11:16:06.611Z be1d2fbc-aa87-11e7-a553-ed5b451ac831 goog.require could not find: _COLON_simple
oh I see... optimizations :simple not :main :simple
@Peeja I found setting the :cljs-lambda/:compiler/:options/:main
key to clojure.core/identity
made that issue go away - the language in the message gives you a clue, but I also initially assumed it was a top level key.
edit: but that may just push the problem downstream to runtime I think.
Hi, great discussion, thanks. However, when I upgrade to clojurescript 1.10.64 and clojure 1.9.0, but even when I try to change :optimizations to :simple or :main I am getting errors compiling:
Exception in thread "main" java.lang.AssertionError: Assert failed: :source-map true must specify a file in the same directory as :output-to "target/my_proj/my_proj.js" if optimization setting applied
(or (nil? (:output-to opts)) (:modules opts) (string? source-map)), compiling:(/private/var/folders/41/b5ntx4mn2mv9qk3jy
@JimTheMan the semantics of source-map
change at different optimization levels: https://clojurescript.org/reference/compiler-options#source-map
Just so it's clearly and explicitly documented, this project.clj solved the issue for me:
(defproject example "0.1.0-SNAPSHOT"
:dependencies [[org.clojure/clojure "1.9.0"]
[org.clojure/clojurescript "1.10.312"]
[io.nervous/cljs-lambda "0.3.5"]]
:plugins [[lein-npm "0.6.2"]
[io.nervous/lein-cljs-lambda "0.6.6"]]
:npm {:dependencies [[serverless-cljs-plugin "0.1.2"]]}
:cljs-lambda {:compiler
{:inputs ["src"]
:options {:output-to "target/example/example.js"
:output-dir "target/example"
:target :nodejs
:language-in :ecmascript6
:optimizations :simple}}})
Is there somewhere I should issue a PR or something?
I'm happy to accept a pr - the leiningen template would be the place to put the change
On Fri, 22 Jun 2018, 18:53 the-frey, notifications@github.com wrote:
Is there somewhere I should issue a PR or something?
— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/nervous-systems/cljs-lambda/issues/88#issuecomment-399525433, or mute the thread https://github.com/notifications/unsubscribe-auth/ABYuK4PGqNlIqnwV3nm1vO0vdadXAc5Gks5t_S75gaJpZM4Nvbyb .
The
serverless
template (and probably the maincljs-lambda
template as well) is incompatible with the current (1.9.562) version of ClojureScript. Builds fail becausejava.lang.AssertionError: Assert failed: :nodejs target with :none optimizations requires a :main entry
.I've tried adding my
.core
namespace as the:main
. Bizarrely, that leads to:(where
<project-name>
is the name of the project)It looks like Clojure is trying to find the namespace instead of ClojureScript? I have no idea what's going on at this point.