This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2023-03-03
Channels
- # announcements (15)
- # babashka (143)
- # babashka-sci-dev (2)
- # beginners (35)
- # biff (11)
- # calva (5)
- # cider (8)
- # clerk (4)
- # clj-kondo (58)
- # cljdoc (6)
- # clojure (88)
- # clojure-denmark (1)
- # clojure-europe (77)
- # clojure-nl (1)
- # clojure-norway (16)
- # clojure-uk (1)
- # clojurescript (19)
- # clr (32)
- # code-reviews (158)
- # datahike (5)
- # datomic (10)
- # deps-new (3)
- # fulcro (12)
- # graalvm (20)
- # honeysql (23)
- # hyperfiddle (32)
- # kaocha (17)
- # membrane (6)
- # observability (1)
- # other-languages (2)
- # pathom (5)
- # practicalli (12)
- # reagent (4)
- # reitit (7)
- # releases (1)
- # sci (25)
- # shadow-cljs (52)
Library name must be specified as a symbol in :require / :require-macros; offending spec: ["dropzone" :refer [Dropzone]]
IIRC lein doo uses the CLJS compiler directly, so it might just not support npm dependencies. shadow-cljs has plenty of testing options you can use instead
HeadlessChrome 0.0.0 (Mac OS X 10.15.7) ERROR
{
"message": "Uncaught ReferenceError: global is not defined\nat test.js:8:15\n\nReferenceError: global is not defined\n at test.js:8:15",
"str": "Uncaught ReferenceError: global is not defined\nat test.js:8:15\n\nReferenceError: global is not defined\n at test.js:8:15"
}
I tried to run karma but it didn’t work. :test {:target :karma
:output-to "target/cljs-test-output/test.js"}
Why is global undefined? It compiled just fine npx shadow-cljs compile test
- created test.js file
I used karma.conf.js from your doco https://shadow-cljs.github.io/docs/UsersGuide.html#_testing
@maris.orbidans I don't know. global
is not generally a thing in browser based builds. is your code trying to access js/global
in some way? what is in line 8 of the test file?
are you replacing goog/base.js in some way? are you messing with the expected closure-library version in some way?
[thheller/shadow-cljs "2.21.0" :exclusions [com.google.errorprone/error_prone_annotations
org.slf4j/slf4j-api
nrepl]]
[org.clojure/clojurescript "1.11.60" :exclusions [com.google.code.findbugs/jsr305
com.google.errorprone/error_prone_annotations
com.google.javascript/closure-compiler-unshaded]]
well, but why are you fixing them in the place that is supposed to bring in the proper versions?
I'm assuming you have :lein true
or :lein {:profiles "+foo"}
in your shadow-cljs.edn
and manage all dependencies in project.clj
?
It is shadow-cljs that pulls in different version of com.google.javascript/closure-compiler-unshaded
There is only single file in cljs-test-output. Does it need some other files? var CLOSURE_BASE_PATH = 'js/cljs-runtime/'
This folder is in ./.shadow-cljs/builds/browser-repl/js/cljs-runtime
the files in .shadow-cljs/builds/browser-repl
are from the browser-repl build. they are in no way related to the test build. they'll be in .shadow-cljs/builds/test
Hi,
I'm trying to use an npm package React date picker
, here:
The docs say:
>
import React, { useState } from 'react';
> import DatePicker from 'react-date-picker';
I've installed it via npm install react-date-picker
Then my requires look like this:
(:require ["react" :refer (useState)]
["react-date-picker" :refer (DatePicker)])
But I get the error
> Failed to inspect file
> /home/stuart/Source/Finance-Planner/Frontend/node_modules/react-calendar/dist/Calendar.css
>
> it was required from
> /home/stuart/Source/Finance-Planner/Frontend/node_modules/react-date-picker/dist/entry.js
>
> Errors encountered while trying to parse file
> /home/stuart/Source/Finance-Planner/Frontend/node_modules/react-calendar/dist/Calendar.css
> {:line 1, :column 1, :message "primary expression expected"}
I can confirm those files exist.
What have I done wrong ?shadow-cljs does not support bundling css files. so libraries that attempt to import css will fail by default.
you can set :js-options {:ignore-asset-requires true}
in the build config which will just ignore them
but the lib likely won't work without it, so its generally best to use this path https://code.thheller.com/blog/shadow-cljs/2020/05/08/how-about-webpack-now.html#option-2-js-provider-external