Here's what I have so far:
(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.
On Friday, September 22, 2017 at 1:33:07 PM UTC-4, Jonathon McKitrick wrote:
>
> Hi all,
>
> I'm slowly but surely weaseling Clojure and Clojurescript into our
> company's codebase. I'm tasked with a script which will read from a MySQL
> database and generate a very simple report.
>
> So far, I have a NodeJS REPL project up and running, but I'm not quite
> sure how to get Node's MySQL library into the project and namespace. Any
> thoughts?
>
>
>
--
Note that posts from new members are moderated - please be patient with your
first post.
---
You received this message because you are subscribed to the Google Groups
"ClojureScript" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/clojurescript.