Open SevereOverfl0w opened 7 years ago
I think I got close, but got this error: Error: Cannot find module '@cljs-oss/module-deps'
You need to run npm install @cljs-oss/module-deps
to use module processing.
I see. That makes sense.
I made some further progress by removing the folder containing the js to compile out of my src
directory (which felt a little wonky, is this expected?).
I couldn't manage to require react 15 (from node_modules) from that external js though however. I'd be quite happy to require the cljsjs.React, but that didn't seem possible either.
The error I saw was this:
TypeError: module$home$dominic$src$github_com$juxt$edge$node_modules$react$react.default is undefined[Learn More]
Looks like you are trying to require React (CommonJS) from ES6 module. That doesn't work currently: https://github.com/google/closure-compiler/issues/2634
And foreign libs (cljsjs) are Cljs only, so they can't be used from module processing modules.
Okay, so if I convert the code to be commonjs throughout, that seems to be working. Unless I end up depending on a module which uses ES6 modules, I guess? (I'm not sure if that can happen)
I thought they might be cljs only, but figured I'd ask regardless.
I have this working now, which is great!
Things that seem to be missing:
src/
or wherever you keep your code, instead of using the classpath like other properties which are transformed automatically, this has been useful in dodging 1, but is probably not desired behaviour.Are these things that boot-cljs should/would fix? Shall I open specific issue(s) to track them?
You can depend on most ES6 modules, but not on those ES6 modules that use CJS.
CommonJS -> ES6 Works ES6 -> CommonJS Doesn't
I have only looked into case where using existing Node packages, which are always under node_modules
, not sure what happens and should happen with local CJS or ES6 modules.
continuation of https://github.com/boot-clj/boot-cljs/issues/151
One annoyance is that
:file
in:foreign-libs
is not prefixed on the classpath automatically to the relevant boot tmp files.