Awesome, thanks! I’ll check it out
I’ve started getting this error on a project I had shadow working on. Not sure what changed.
hadow-cljs - starting via "clojure"
[2020-08-28 19:15:35.245 - WARNING] :shadow.cljs.devtools.server/nrepl-ex
Note: The following stack trace applies to the reader or compiler, your code was not executed.
CompilerException Unexpected error macroexpanding if-ns at (cider/piggieback.clj:22:1). #:clojure.error{:phase :macroexpansion, :line 22, :column 1, :source "cider/piggieback.clj", :symbol if-ns}
clojure.lang.Compiler.macroexpand1 (Compiler.java:7019)
clojure.lang.Compiler.macroexpand (Compiler.java:7075)
clojure.lang.Compiler.eval (Compiler.java:7161)
clojure.lang.Compiler.load (Compiler.java:7636)
clojure.lang.RT.loadResourceScript (RT.java:381)
clojure.lang.RT.loadResourceScript (RT.java:372)
clojure.lang.RT.load (RT.java:459)
clojure.lang.RT.load (RT.java:424)
clojure.core/load/fn--6839 (core.clj:6126)
clojure.core/load (core.clj:6125)
clojure.core/load (core.clj:6109)
clojure.core/load-one (core.clj:5908)
Caused by:
NoSuchFieldError ES3
cljs.closure__init.load (:133)
cljs.closure__init.<clinit> (:-1)
java.lang.Class.forName0 (Class.java:-2)
java.lang.Class.forName (Class.java:427)
clojure.lang.RT.classForName (RT.java:2211)
clojure.lang.RT.classForName (RT.java:2220)
clojure.lang.RT.loadClassForName (RT.java:2239)
clojure.lang.RT.load (RT.java:449)
clojure.lang.RT.load (RT.java:424)
clojure.core/load/fn--6839 (core.clj:6126)
clojure.core/load (core.clj:6125)
clojure.core/load (core.clj:6109)
shadow-cljs - HTTP server available at <http://localhost:8021>
shadow-cljs - server version: 2.10.21 running at <http://localhost:9630>
shadow-cljs - watching build :app
[:app] Configuring build.
[:app] Compiling ...
[2020-08-28 19:15:45.805 - WARNING] :shadow.cljs.devtools.server.util/handle-ex - {:msg {:type :start-autobuild}}
NoClassDefFoundError Could not initialize class cljs.repl__init
java.lang.Class.forName0 (Class.java:-2)
java.lang.Class.forName (Class.java:427)
clojure.lang.RT.classForName (RT.java:2211)
clojure.lang.RT.classForName (RT.java:2220)
clojure.lang.RT.loadClassForName (RT.java:2239)
clojure.lang.RT.load (RT.java:449)
clojure.lang.RT.load (RT.java:424)
clojure.core/load/fn--6839 (core.clj:6126)
clojure.core/load (core.clj:6125)
clojure.core/load (core.clj:6109)
clojure.core/load-one (core.clj:5908)
clojure.core/load-one (core.clj:5903)
Actually seems like I bumped up against this before. It’s when I use :deps {:aliases [:cljs]}
instead of :dependencies
which I was avoiding for duplication reasons
Hello friends. I am completely stumped. I have a typescript npm pkg that I’m building that includes a set of components. One of these components is named DatePicker. Under the covers it uses https://github.com/Hacker0x01/react-datepicker.
On the clojurescript side, I do a (:require ["@foo/bar" :as bar])
and then do [:> bar/DatePicker …]
The error I get is: Uncaught Error: Element type is invalid: expected a string (for built-in components) or a class/function (for composite components) but got: undefined. You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.
Looking at the react-datepicker issues, I came across: https://github.com/Hacker0x01/react-datepicker/issues/1333 but changing my tsx code to point at ReactDatePicker.default doesn’t seem to do the trick either.
What I have verified is that I can indeed use react-datepicker
directly, but not when it’s nested in a component from another package.
I don’t know if this is a shadow-cljs question or not, but I am quite confused and any help would be appreciated.
on the TS side, the component file looks roughly like:
import * as React from 'react';
import ReactDatePicker from 'react-datepicker';
export interface DatePickerProps {
...
}
export const DatePicker = (props: DatePickerProps) => {
...
return (
<div>
<ReactDatePicker
...
/>
</div>
);
};
hey there, two quick questions:
1. I’ve got a :node-script
target with :compiler-options {:hashbang false}
yet a shebang still seems to be getting inserted at the beginning of my compiled file. any idea what might be causing that? I’m on 2.11.1
2. is there a way to inline generated source maps as opposed to keeping them in separate files?
its just a version conflict you need to resolve. see https://shadow-cljs.github.io/docs/UsersGuide.html#failed-to-load
@devn see https://shadow-cljs.github.io/docs/UsersGuide.html#_about_default_exports
@mss :hashbang false
is directly in the build config, not inside :compiler-options
:compiler-options {:source-map-inline true}
@thheller anything to add there? The trouble seems to be with the ReactDatePicker, not my component that wraps it.
and I expose a number of components from the lib, via a :require :as
I don't know what you are doing
> Element type is invalid: expected a string (for built-in components) or a class/function (for composite components) but got: undefined.
is telling you that when using [:> Thing ...]
Thing
was undefined. so you said bar/DatePicker
which probably meant bar/DatePicker
is undefined
thats all I can tell you without seeing more code
bar/DatePicker is there, but I get the error about a nested component within that component named ReactDatePicker
but it works fine on the plain typescript side
Please create a minimal reproducible example. Otherwise it's unproductive guesswork.
will do