"Late provide error" in compiling clojurescript files

179 views
Skip to first unread message

Praki

unread,
Jan 3, 2012, 3:19:51 AM1/3/12
to Clojure
Hi,

I have a silly problem compiling my cljs files. I have to run the
cljsc command twice in succession to generate javascript source. The
first compilation results in:

ERROR: JSC_LATE_PROVIDE_ERROR. required "foo.bar" namespace not
provided yet at /home/.../src/../target/classes/public/js/core.js line
18 : 12

Please note that my core.cljs requires foo.bar namespace. The second
cljsc command works without any error.

I doubt that clojurescript compiler requires running it multiple times
in succession and suspect some problem in my usage of it. I would
expect closure compiler to process the transitive dependencies
correctly.

I see the same issue with cljs-watch which is a major productivity
issue for me.

Has anyone else encountered this issue? Does anybody know the cause of
this error?

Thanks

Benjamin Teuber

unread,
Jan 4, 2012, 10:44:23 AM1/4/12
to Clojure
Hi,

I just had the same problem and discovered it was a cyclic dependency
- maybe you want to check for that, too..

Regards Benjamin

Praki Prakash

unread,
Jan 4, 2012, 1:31:30 PM1/4/12
to clo...@googlegroups.com
Thanks for your response Benjamin. I was leaning towards cyclic
dependency myself. I couldn't get closurebuilder.py (which apparently
detects cyclic dependencies) but couldn't get it to run on my source.
After your response, I did a dependency analysis by hand and found no
cycles. However, I narrowed down this error to only hyphenated
namespaces. After some more snooping around, I found the cause to be
requiring foo.bar-baz as foo.bar_baz (in some places). I suspect that
this confused the dependency analysis. I don't fully understand
how/why it works when I compile again but, boy, am I glad to have
cljs-watch work! Big time saver!

Hopefully, someone from the clojurescript compiler team can enlighten on this.

> --
> You received this message because you are subscribed to the Google
> Groups "Clojure" group.
> To post to this group, send email to clo...@googlegroups.com
> Note that posts from new members are moderated - please be patient with your first post.
> To unsubscribe from this group, send email to
> clojure+u...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/clojure?hl=en

--
(praki)

Reply all
Reply to author
Forward
0 new messages