Welcome! Please see the About page for a little more info on how this works.

0 votes
in ClojureScript by

Hi everyone, I setup a demo to explore how cljs could require a npm package, I install two npm packages puppeteer and pdfjs via npm install, and require them in ns statement, puppeteer works fine, but pdfs failed, it seems strange to me as those two packages are required in the same way.

Steps to reproduce:
1. clone https://github.com/jiacai2050/cljs-demo.git
2. comment out pdfjs in core.cljs
3. npm install
4. lein dev-build

by
It seems cljs already fix this issue.

```
  :dependencies [[org.clojure/clojure "1.11.1"]
                 [org.clojure/clojurescript "1.11.132"]]
```

With those version, the following code works as expected:

```clj
(ns cljs-demo.core
  (:require [pdfjs]
            [puppeteer]))

(enable-console-print!)

(defn -main [& args]
  (println "Hello, World!" puppeteer)
  (println "Hello, World!" pdfjs)
  )

(set! *main-cli-fn* -main)

```

2 Answers

0 votes
by
 
Best answer

It seems cljs already fix this issue.

  :dependencies [[org.clojure/clojure "1.11.1"]
                 [org.clojure/clojurescript "1.11.132"]]

With those version, the following code works as expected:

(ns cljs-demo.core
  (:require [pdfjs]
            [puppeteer]))

(enable-console-print!)

(defn -main [& args]
  (println "Hello, World!" puppeteer)
  (println "Hello, World!" pdfjs)
  )

(set! *main-cli-fn* -main)
+1 vote
by
...