Fork me on GitHub
#cljs-dev
<
2017-09-28
>
juhoteperi20:09:22

I seem to have hit a problem with using React UMD modules on Node (while testing Reagent)

juhoteperi20:09:55

Cljs loads React UMD file OK, but create-react-class doesn't work as it tries to use require("react") as exports and module are defined, but React module can't be found

juhoteperi20:09:32

I wonder if such case has ever worked? Reagent didn't use create-react-class previously

juhoteperi20:09:51

Though probably loading react-dom which requires react should cause the same problem

juhoteperi20:09:39

> require("/home/juho/Source/reagent/out/cljsjs/react-dom/development/react-dom.inc.js");
Error: Cannot find module 'react'
Yeah, hmm...

thheller20:09:54

@juhoteperi @rauh had another issue earlier where the UMD file leaked some variables into the global scope. maybe their UMD bundler got messed up in some way.

juhoteperi20:09:34

Could be. I'm trying to understand how this Node bootstrap code affects this.

juhoteperi20:09:41

nodeGlobalRequire clearly would run the code without module or exports, but I'm not sure if that is used here

thheller20:09:50

which files is react-dom.inc.js? there are a bunch of different .js files in react-dom now

juhoteperi20:09:04

This is with 15.6 still

thheller20:09:33

ah ok thought you were testing v16

juhoteperi20:09:02

I was, initially, but the whole test setup for Reagent is so "delicate" I decided to improve that first

juhoteperi20:09:11

After that change, normal require is used instead of nodeGlobalRequire

juhoteperi21:09:38

I wonder if require change was intended as commit speaks about __dirname and __filename

juhoteperi21:09:18

But advanced build doesn't work either, and it that case goog.require shouldn't matter at all as all code is already in the same JS file