This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2017-02-17
Channels
- # beginners (52)
- # boot (116)
- # cider (21)
- # cljs-dev (44)
- # clojure (104)
- # clojure-dev (82)
- # clojure-greece (5)
- # clojure-japan (4)
- # clojure-nl (14)
- # clojure-russia (65)
- # clojure-serbia (3)
- # clojure-spec (38)
- # clojure-uk (9)
- # clojure-ukraine (1)
- # clojurescript (65)
- # clojurewest (1)
- # community-development (1)
- # core-logic (3)
- # cursive (5)
- # data-science (9)
- # datomic (13)
- # emacs (45)
- # euroclojure (1)
- # hoplon (2)
- # instaparse (23)
- # javascript (1)
- # jobs (2)
- # klipse (43)
- # leiningen (8)
- # lumo (25)
- # off-topic (7)
- # om (13)
- # om-next (3)
- # onyx (11)
- # pedestal (12)
- # planck (19)
- # proton (1)
- # re-frame (26)
- # reagent (26)
- # remote-jobs (13)
- # ring-swagger (23)
- # spacemacs (1)
- # untangled (3)
@dnolen hmm that doesn’t seem to be the problem.. Adding this top-level expr (println [js/__dirname (contains? (set (.keys js/Object js/global)) “__dirname”)])
outputs [nil true]
I’m testing out the node modules support in clojurescript 1.9.473 and I'm having an issue using the d3
module from npm
I'm using the example from https://clojurescript.org/guides/javascript-modules verbatim except I've added {"d3": "4.5.0"}
as a dependency to package.json
(and installed it) and I added the line var d3 = require("d3");
to the npm_stuff.js file after the other require
statments.
When I try to build the project I get the error:
ERROR: JSC_COMMONJS_MODULE_LOAD_ERROR. Failed to load module "d3" at .../jsfresh/src/libs/npm_stuff.js line 3 : 9
Exception in thread "main" java.lang.IllegalStateException: Cannot build without root node being specified, compiling: ...
Any ideas why this would happen?
I tried it with the externs from cljsjs included the same way as the react externs were and get the same error
it just sounds like you missed a step or something about d3 makes it not get picked up
the JS modules stuff is very experimental so you need to expect to have to debug and investigate these kinds of issues on your own
ok I’ll see if I can figure anything else out. will get a report together if I can narrow this down at all
thanks for commenting
make something minimal that demonstrates the problem and maybe somebody will take a look
will do. so far trying other npm libraries and this seems specific to d3. doesn’t happen with lodash or jquery
cljs.build.api/node-inputs
invokes a JS script that calls module-deps
a NPM lib for figuring this out
ok I’ll dig around with that
yeah, the main for d3 is build/d3.node.js
maybe the extra dot causes a bug in module-deps
I’ll try a few more libs and see if I can find any patterns
@anmonteiro does this sound like something obvious to you? ^
I think that there’s just not enough information to start pointing fingers
I would be really surprised if the dots in the d3
main were the problem for example
just looks like there’s a file missing from the foreign-libs
entry
@dnolen I feel like a minimal repro (even with d3) would be helpful
@anmonteiro makes sense @chris-andrews ^
ok, will try to put together a minimal example for you
so far have also found a problem with http://socket.io
other libs I’ve tried from the most popular list on npm don’t seem to have the same issues
trying d3 now
@dnolen @chris-andrews I suppose the problem with d3
is that it’s doing fancy dynamic stuff with the exports
'use strict';
Object.defineProperty(exports, '__esModule', { value: true });
var d3Voronoi = require('d3-voronoi');
var d3Zoom = require('d3-zoom');
var version = "4.5.0";
exports.version = version;
Object.keys(d3Voronoi).forEach(function (key) { exports[key] = d3Voronoi[key]; });
Object.keys(d3Zoom).forEach(function (key) { exports[key] = d3Zoom[key]; });
Object.defineProperty(exports, "event", {get: function() { return d3Selection.event; }});
example ^
I don’t think that’s going to work
the alternative will be requiring d3/index
, but that doesn’t work with the current CLJS compiler because we need to bump Closure to have the ES6 import feature:
https://github.com/d3/d3/blob/master/index.js
@anmonteiro interesting & looks like that’s the issue
@anmonteiro I think pprint patch needs a rebase?
let me check it out
@dnolen thanks for the heads up. just attached a rebased patch