Fork me on GitHub
#reagent
<
2017-11-02
>
brunex11:11:06

hi good morning, I'm having a error with reagent 8 alpha2 Uncaught ReferenceError: process is not defined

p-himik11:11:41

Do you use :npm-deps?

brunex11:11:04

:compiler     {:main                 gecko.core
                    :output-to            "resources/public/js/compiled/app.js"
                    :output-dir           "resources/public/js/compiled/out"
                    :asset-path           "/js/compiled/out"
                    :npm-deps
                    {:react "16.0.0"
                     :react-dom "16.0.0"
                     :create-react-class "15.6.2"}
                    :install-deps true
                    :infer-externs true
                    :source-map-timestamp true
                    :closure-defines {goog.DEBUG true}
                    :preloads             [devtools.preload
                                           re-frisk.preload]
                    :external-config      {:devtools/config {:features-to-install :all}}
                    }

p-himik11:11:30

I was having the exact same problem a couple of days ago. Remove re-frisk.preload.

brunex11:11:23

trying it out! many thanks!

brunex11:11:20

Uncaught Error: Undefined nameToPath for cljsjs.react

brunex11:11:25

new error šŸ™‚

p-himik11:11:46

Try lein clean, rm node_modules and run the build again.

p-himik11:11:47

By the way, if you won't add anything else to :npm-deps and React 15 is enough for you, you don't need :npm-deps at all.

brunex11:11:43

well the problem is that I want also to run this via nodeJS

brunex11:11:07

to perform some server-side render

p-himik11:11:24

Ah, I see.

brunex11:11:29

the problem remains šŸ˜•

brunex11:11:45

:infer-externs true

brunex11:11:47

this is correct?

brunex11:11:56

trying without

p-himik11:11:03

I've never used this flag - I use oops for JS interop.

p-himik11:11:31

Also, could you try the version of React that Reagent uses?

brunex11:11:33

react 15.6.2

pesterhazy11:11:37

you could try putting that on top of your index.html

pesterhazy11:11:46

<script>window.process = window.process || {env: {NODE_ENV: "dev"}};</script>

pesterhazy11:11:22

not saying this is a proper solution but it may get you a step further šŸ™‚

p-himik11:11:29

But only if everything else fails.

brunex11:11:48

[reagent "0.8.0-alpha2" :exclusions [[cljsjs/create-react-class]
                                                      [cljsjs/react-dom-server]
                                                      [cljsjs/react-dom]
                                                      [cljsjs/react]]]

brunex11:11:02

tried removing exclusions and seems to work

brunex11:11:14

but seems odd

p-himik11:11:17

Aha! I did not have these exclusions in the first place.

p-himik11:11:08

In the migration guide to Reagent 0.8 it's stated that if React is found in node_modules, cljsjs/react will still be used, but only for externs. I'm not sure how that works, but maybe that's the problem.

brunex11:11:54

working in the browser testing with nodejs now

brunex11:11:15

seems to be working

brunex11:11:30

lost re-frisk only šŸ™‚

brunex11:11:41

thanks guys

p-himik11:11:47

You can still use it, but not in the preloads.

brunex11:11:09

can you point me to how?

brunex11:11:58

(enable-re-frisk-remote!)

brunex11:11:06

something like this on my code?

p-himik11:11:09

Just call it in your :main, yes.

p-himik11:11:28

Just make sure that re-frisk is available as a dependency in the relevant build.

brunex11:11:37

yep thanks

p-himik13:11:34

@brunex In #clojurescript it was pointed out that you can just add process.env as the first preload and leave re-frisk in the list of preloads.

brunex13:11:00

going to give it a try

brunex14:11:36

what is the best way to get a reagent component rendered as HTML

brunex14:11:15

in reagent 8

mikerod14:11:02

Not sure if has been mentioned here yet (donā€™t see it), but some reason that I have not tracked down, the ā€œBMI calculatorā€ on this reagent tutorial page http://reagent-project.github.io/ isnā€™t working

mikerod14:11:12

the sliders donā€™t change the values of the height/weight/bmi

mikerod15:11:13

running the code it shows there locally works though. I believe it used to work on the site too (if I remember correctly). Someone who was just trying to learn reagent pointed this out to me yesterday because they were confused what it was supposed to be doing.

brunex15:11:47

TypeError: Cannot read property 'renderToString' of undefined
    at reagent$dom$server$render_to_string

brunex15:11:02

allways getting this error when trying to render stuff šŸ˜•

pwrflx18:11:04

hi! how to add a custom HTML attribute to a reagent component?

gadfly36119:11:21

Sounds very possible, thanks @mikerod for pointing that out!

mikerod19:11:51

No problem

juhoteperi20:11:17

For some reason Range inputs don't trigger onChange events

mikerod20:11:12

>For some reason Range inputs donā€™t trigger onChange events uh oh

juhoteperi20:11:39

... on this particular environment and adv build

juhoteperi21:11:41

Demo site is for now built using UMD module, I'll create issue about this and hopefully I can create tests to validate this case

kishanov22:11:35

Hi there. Is it possible to use Reagent component from JavaScript/React app?