Fork me on GitHub
#shadow-cljs
<
2020-08-28
>
mkarp07:08:30

Awesome, thanks! I’ll check it out

grounded_sage17:08:10

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 
shadow-cljs - server version: 2.10.21 running at 
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)

grounded_sage17:08:46

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

devn17:08:38

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.

devn17:08:37

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.

devn17:08:58

I don’t know if this is a shadow-cljs question or not, but I am quite confused and any help would be appreciated.

devn17:08:38

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>
  );
};

mss18:08:44

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?

thheller20:08:21

@mss :hashbang false is directly in the build config, not inside :compiler-options

🙌 3
thheller20:08:01

:compiler-options {:source-map-inline true}

devn20:08:02

@thheller anything to add there? The trouble seems to be with the ReactDatePicker, not my component that wraps it.

devn20:08:19

and I expose a number of components from the lib, via a :require :as

thheller20:08:59

I don't know what you are doing

thheller20:08:10

> Element type is invalid: expected a string (for built-in components) or a class/function (for composite components) but got: undefined.

thheller20:08:48

is telling you that when using [:> Thing ...] Thing was undefined. so you said bar/DatePicker which probably meant bar/DatePicker is undefined

thheller20:08:59

thats all I can tell you without seeing more code

devn20:08:13

bar/DatePicker is there, but I get the error about a nested component within that component named ReactDatePicker

devn20:08:36

but it works fine on the plain typescript side

p-himik08:08:09

Please create a minimal reproducible example. Otherwise it's unproductive guesswork.