Fork me on GitHub
#cljs-dev
<
2017-03-28
>
mfikes13:03:13

It is not immediately obvious to me how you can fix http://dev.clojure.org/jira/browse/CLJS-1989, so I just logged it for now. (It involves a side effect during macroexpansion.) Perhaps someone here might have a clever idea. 🙂

Roman Liutikov14:03:33

Is it possible that ClojureScript compiler can not resolve certain Closure compatible modules?

Roman Liutikov14:03:26

I can post a repro if needed. Basically I have this in compiler config :libs ["src/app_db_gen.js"] which has goog.provide('app.db’);,

Roman Liutikov14:03:40

but CLJS compiler throws No such namespace: app.db, could not locate app/db.cljs, app/db.cljc, or Closure namespace “app.db”

dnolen14:03:37

@roman01la it should work yes

dnolen14:03:26

@roman01la I really don’t have time to look at repro projects

dnolen14:03:47

do this with the Quick Start uberjar please - no other variables

thheller15:03:29

@roman01la your cljs file does (:require [app.db :as db]) but the .js file never provides that

thheller15:03:10

seems like you are missing a goog.provide('app.db');

thheller15:03:32

in the js file

thheller15:03:07

ah doh .. didn't scroll to the bottom 🙂

thheller15:03:29

pretty sure they all must come first

thheller15:03:39

just like the ns form in cljs

thheller15:03:11

I think the provide extractor stops at the first none goog.provide/goog.require

thheller15:03:20

try to move those provide/require to the top of the file

Roman Liutikov15:03:47

I suspect Closure Compiler doesn’t care about location of the goog.provide call?

thheller15:03:44

yes, it does not care

thheller15:03:29

something I meant to write a patch for but never got a around to

thheller15:03:53

closure has https://github.com/google/closure-compiler/blob/master/src/com/google/javascript/jscomp/deps/JsFileParser.java but cljs.closure is using a custom made regexp solution to extract provide/require

Roman Liutikov15:03:26

is there any reason behind this?

thheller15:03:27

it just never came up as a problem 😉

thheller15:03:36

well now with self-host there is a legit reason not to use the java code

thheller15:03:05

yeah that still stops early