(defproject foo "0.1.0-SNAPSHOT"
:description "FIXME"
:dependencies [[org.clojure/clojure "1.8.0"]
[org.clojure/clojurescript "1.9.908"]
[com.cemerick/piggieback "0.2.2"]]
:plugins [[lein-cljsbuild "1.1.7"]
[lein-ancient "0.6.12"]]
:repl-options {:nrepl-middleware [cemerick.piggieback/wrap-cljs-repl]}
:source-paths ["src"]
:cljsbuild
{:builds
[{:source-paths ["src"]
:compiler
{:target :nodejs
:output-to "check_templates.js"
:optimizations :none
:npm-deps {:mysql "2.14.1"}
:install-deps true
:main check-templates.core
:parallel-build true}}]})
and
(ns check-templates.core
(:require [cljs.nodejs :as nodejs]
#_[mysql :as sql]))
(nodejs/enable-util-print!)
(defn -main [& args]
(.log js/console "Hello world")
(println "Hello world"))
(set! *main-cli-fn* -main)
I run `lein cljsbuild once` and I get the node_modules directory populated with dependencies.
I can run `lein repl` and then use piggieback to get to the CLJS repl. But I seem unable to get the mysql dependency imported.
If I enable the `require` form to import mysql in the source file and then start the repl and require the project namespace, I get this error:
events.js:160
throw er; // Unhandled 'error' event
^
Error: Can't resolve 'url' in '/Users/devmbp42/arc/check-templates/node_modules/mysql/lib'
at onError (/Users/devmbp42/arc/check-templates/node_modules/enhanced-resolve/lib/Resolver.js:61:15)
So it's finding the modules and attempting to load them. But I don't know enough about NodeJS to understand exactly what is broken or how to fix it.