omcljs / om

ClojureScript interface to Facebook's React
6.66k stars 362 forks source link

WIP: Global-exports to require React and support node modules #887

Open Deraen opened 6 years ago

Deraen commented 6 years ago

This is similar to https://github.com/reagent-project/reagent/pull/306 https://github.com/reagent-project/reagent/blob/master/CHANGELOG.md#080-alpha1-2017-07-31

I'm opening PR's on other related projects also:

It is possible further changes to ClojureScript will make this change (partially) unnecessary: https://dev.clojure.org/jira/browse/CLJS-2331

There are problems with this change currently,

Running build with boot devcards shows lots of warnings:

WARNING: No such namespace: react, could not locate react.cljs, react.cljc, or JavaScript source providing "react" at line 6 src/devcards/om/devcards/shared_fn_test.cljs

And errors at browser console, caused by code generated by defui: image

petterik commented 6 years ago

@Deraen the CircleCI build failed because it couldn't find artifact devcards:devcards-0.3.0-SNAPSHOT. Maybe try rebuilding the build? Or if it actually doesn't exist, update the version?

Deraen commented 6 years ago

@petterik It doesn't exist as that depends on devcards update (PR linked), and all the changes are still WIP, and the devcards update depends on om update. It will be fun to release these, when this is ready, due to cyclic dependencies :)

petterik commented 6 years ago

Btw @Deraen, I tried to get om.next to work with react from node_modules and started from your WIP commit in this pull request. I had to some more changes to do with om.dom marcos referring to js/React and js/React.DOM, and maybe something else.

Not everything I did is related to this PR, but here's the diff: https://github.com/Deraen/om/compare/new-react-require...petterik:petter/new-react-require

Deraen commented 6 years ago

@petterik Nice. Perhaps similar macro fixes will help with Sablono and Rum, which I think also had similar problems.