We are trying to introduce clojurescript in a project which is currently written in angularjs. We are using an external javascript library - datamaps. We are using the :foreign-libs compiler option to get the dependency file in the following manner :
:compiler {:output-to "resources/public/js/testable.js"
:main "gofigure.test-runner"
:foreign-libs [{:file "globe.js"
:provides ["globe"]}
{:file "datamaps/src/js/datamaps.js"
:provides ["datamaps"]}
{:file "d3/d3.js"
:provides ["d3"]}
{:file "topojson/topojson.js"
:provides ["topojson"]}}}
We are facing an error that says : "Cannot read property 'world' of undefined"
We narrowed this issue down to an issue in the datamaps file and we think this is because in the foreign-libs option we are mentioning the specific datamaps.js file, but we are missing out the other files in the datamaps folder, and hence not compiling the entire library accurately.
Is there any way to include the entire library as a dependency and not just a single file?
Shadow-cljs could resolve this issue.
Shadow-cljs solves these probems reliably, optimally, and with minimal configuration. In paricular, shadow-cljs lets you install npm modules using npm or yarn and uses the resulting package.json to bundle external dependencies.
For further details https://gist.github.com/jmlsf/f41b46c43a31224f46a41b361356f04d
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With