shadow-cljs

https://github.com/thheller/shadow-cljs | https://github.com/sponsors/thheller | https://www.patreon.com/thheller
mkarp 2020-08-28T07:10:30.321700Z

Awesome, thanks! I’ll check it out

grounded_sage 2020-08-28T17:17:10.322600Z

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)

grounded_sage 2020-08-28T17:26:46.323700Z

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

devn 2020-08-28T17:49:38.327300Z

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 [:&gt; 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.

devn 2020-08-28T17:50:37.328500Z

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.

devn 2020-08-28T17:50:58.329Z

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

devn 2020-08-28T17:53:38.331Z

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) =&gt; {
 ...
  return (
    &lt;div&gt;
      &lt;ReactDatePicker
        ...
      /&gt;
    &lt;/div&gt;
  );
};

2020-08-28T18:07:44.334500Z

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?

thheller 2020-08-28T20:02:20.334600Z

its just a version conflict you need to resolve. see https://shadow-cljs.github.io/docs/UsersGuide.html#failed-to-load

thheller 2020-08-28T20:04:21.335900Z

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

🙌 1
thheller 2020-08-28T20:05:01.336400Z

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

devn 2020-08-28T20:12:02.337Z

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

devn 2020-08-28T20:12:19.337400Z

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

thheller 2020-08-28T20:14:59.337900Z

I don't know what you are doing

thheller 2020-08-28T20:15:10.338100Z

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

thheller 2020-08-28T20:15:48.338900Z

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

thheller 2020-08-28T20:15:59.339100Z

thats all I can tell you without seeing more code

devn 2020-08-28T20:20:13.339800Z

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

devn 2020-08-28T20:21:36.340700Z

but it works fine on the plain typescript side

p-himik 2020-08-29T08:04:09.341Z

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

devn 2020-08-30T02:15:08.001800Z

will do