Fork me on GitHub
#shadow-cljs
<
2020-05-23
>
David Pham07:05:13

Is it possible to create a nrepl connection into a production nodejs script?

Lucy Wang14:05:36

I think you have to checkout how to use self-hosted cljs (lumo) as a library

andre11:05:14

release 0.2.1 version for https://github.com/flexsurfer/rn-shadow-steroid react navigation with hot reload is simpler now, and also supports build notifiers

👍 8
Saikyun17:05:58

I'm trying to require some js-files, for some reason I get the error:

Requested module does not have an export "EventDispatcher".
--- js/lul/OrbitControls.js:10
and many like it. the js-file looks like this:
import {
	EventDispatcher,
	MOUSE,
	Quaternion,
	Spherical,
	TOUCH,
	Vector2,
	Vector3
} from "three";
when looking at your example: https://github.com/shadow-cljs/examples/blob/master/local-js/src/demo/foo.js it seems like you are doing the same thing. so can't really figure out what I'm doing wrong

thheller17:05:46

@saikyun since "three" is a JS dependency that doesn't go through closure you cannot use refers like that. closure is rather picky on that subject and I haven't found a way to "allow all". import * as THREE from "three" should do it.

thheller17:05:15

or import THREE from "three"

thheller17:05:28

commonjs<->esm interop is still rather meh

Saikyun17:05:33

cool, that did the trick. cheers! 🙂

Saikyun17:05:13

I understand, am I understanding it correctly if I say require/`module.exports` is commonjs? and that's what shadow-cljs prefers?

thheller17:05:45

shadow-cljs prefers ESM but as soon as you are using npm modules you might be better off sticking with commonjs

thheller17:05:18

the rules for that are a lot less strict and generally interop with other commonjs works a bit better

thheller17:05:45

the goal is to eventually get to everything using ESM though ...

Saikyun17:05:11

okay, good to know

Saikyun17:05:40

hmm, it seems that certain things doesn't get picked up by the import * -part. but if I did the require(...)-way it works. :x

thheller17:05:05

> commonjs<->esm interop is still rather meh

Saikyun17:05:50

hehe 😄 I don't mind, just putting it out there in case anyone else stumbles over the chat log 🙂

Saikyun17:05:18

either way, thanks as always. shadow-cljs is currently being used both on my game project and at work. very happy with it.

Saikyun18:05:57

hmm -- for some reason, that broke down when running on expo. maybe I should go back to putting my js code in an npm module instead

Saikyun18:05:11

I did that before, but yarn link was pretty painful sometimes ^^;

Saikyun18:05:54

anyway, don't bother about it, I'll solve it some other way 🙂 sometimes I get the feeling that the three-libs aren't structured nicely either