This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2021-05-31
Channels
- # announcements (1)
- # babashka (27)
- # beginners (33)
- # cider (22)
- # clj-kondo (1)
- # cljdoc (2)
- # cljs-dev (8)
- # clojure (96)
- # clojure-australia (7)
- # clojure-europe (24)
- # clojure-nl (1)
- # clojure-taiwan (1)
- # clojure-uk (7)
- # clojuredesign-podcast (4)
- # clojurescript (23)
- # clojureverse-ops (1)
- # conjure (11)
- # cursive (29)
- # datahike (1)
- # datascript (8)
- # datomic (4)
- # emacs (1)
- # figwheel-main (1)
- # fulcro (3)
- # helix (7)
- # jobs (4)
- # lsp (6)
- # malli (3)
- # off-topic (35)
- # pathom (6)
- # re-frame (4)
- # releases (1)
- # sci (18)
- # shadow-cljs (14)
- # sql (1)
- # tools-deps (11)
- # xtdb (6)
@ketan.srivastav shadow-cljs has no notion of manifest versions, you just put whatever into the manifest. no clue how that works nowdays.
I’m trying to require node-xlsx but somehow I’m not having luck with this:
import xlsx from 'node-xlsx';
translated to this (https://shadow-cljs.github.io/docs/UsersGuide.html#npm)
["node-xlsx" :default xlsx]
With this approach xlsx
is nil
. With other approaches it returns an empty object but nothing that contains the build
method mentioned in https://www.npmjs.com/package/node-xlsxtry :as
instead of :default
(as per 2nd paragraph in https://shadow-cljs.github.io/docs/UsersGuide.html#_about_default_exports)
Still getting (.-build xlsx) => nil
maybe try (js/require "node-xlsx")
, there seem to some newer ESM only node packages that only work with import
. those are not yet supported.
but there is a // Or var xlsx = require('node-xlsx').default;
example so should be fine?
I tried plain js/require but got an empty ja map there too. I’ll give this another try tomorrow
I just went thru something similar with https://github.com/daily-co/daily-js It had two “libraries” under node-modules@daily-co/daily-js/dist/
I first tried out doing the explicit file import as part of the require:
(:require
["@daily-co/daily-js/dist/daily-iframe-esm.js" :default DailyIframe])
to see which one worked and then moved it into shadow-cljs:
:js-options
{:resolve {"@daily-co/daily-js" {:target :npm
:require "@daily-co/daily-js/dist/daily-iframe-esm.js"}}}
as per https://shadow-cljs.github.io/docs/UsersGuide.html#js-resolve-npmThat being said, now that I did a quick try with xlsx, you are having a different problem. xlsx is being set from (:require ["node-xlsx" :as xlsx])
so the basic import is working
Actually for me it works fine:
(:require ["node-xlsx" :as xlsx])
(js/console.log "XLSX: " (.-build xlsx))
Produces the following in the console:
XLSX: λ[]
jsƒ (worksheets,options)
Using :default
instead of :as
works the same for me.So for me it actually turned out the problem existed between the chair and the keyboard. I thought I installed a different library than what I had actually installed, thus the require didn’t work. Interestingly it didn’t hard-fail either