Fork me on GitHub
#reagent
<
2020-04-15
>
Juho Leinonen12:04:30

Hello, we updated Reagent from version 0.8.1 to the newest version and somehow got ourselves a weird problem with our CLJS tests in CI (Linux). We have lein-doo + karma + Chrome setup for the tests and after the update the tests fail with the error

Chrome Headless 79.0.3945.130 (Linux x86_64) ERROR
  Uncaught ReferenceError: module$<path_here>$node_modules$object_assign$index is not defined
  at target/generated/js-tests/public/test-js/out/react.production.min.js:4:231
  ReferenceError: module$<path_here>$node_modules$object_assign$index is not defined
      at target/generated/js-tests/public/test-js/out/react.production.min.js:4:231
We use react from cljsjs (as a direct dependency, but same version that comes with Reagent). This does not happen on my machine (mac) - there isn't even that file target/generated/js-tests/public/test-js/out/react.production.min.js present on my machine. We use cljs compiler options for the karma related things but for nothing else:
:npm-deps {:karma "5.0.1"
           :karma-cljs-test "0.1.0"
           :karma-chrome-launcher "3.1.0"}
but now I noticed the generated package.json does have react and react-dom in it whereas before they weren't there. Not sure if it is related though. Any ideas where the problem could be? Many different things are present but as the problem happened after Reagent update, I thought I'd ask here first.

Juho Leinonen12:04:06

Well now I set

:install-deps false
for those test npm deps, removed react and react-dom from node_modules and now the tests run just fine. Is Reagent somehow adding react and react-dom to the generated package.json?

Juho Leinonen13:04:17

Is this everything working as intended and me just not understanding how install-deps option works?

juhoteperi14:04:18

Working as intended. Reagent declares npm dependency on React (mostly for Shadow-cljs use) and if you set :install-deps true those will be installed: https://github.com/reagent-project/reagent/blob/master/src/deps.cljs

Juho Leinonen05:04:39

Hmm so that explains one thing but doesn't really still explain (at least to me) why the build fails. And only on Linux, not Mac.

Juho Leinonen05:04:47

Maybe I have some stuff left from previous build on my machine and that's why it works...

aarkerio17:04:25

hi! what function replace "reagent/render" ?

p-himik17:04:53

IIRC reagent.dom/render. It should be in the deprecation notice.

aarkerio17:04:35

I'm getting "reagent.core/render is deprecated"

aarkerio17:04:28

"mount-root" looks like is the new thing.

arttuka17:04:59

it's reagent.dom/render , like p-himik already said

aarkerio17:04:10

I see, thx!

kenny23:04:40

Is there a table with which versions of React are compatible with which versions of Reagent?