You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
tl;dr
Woah, sorry this turned out to be a longer issue than I expected. I have a solution but it requires manual editing of a compiled file… 👎
Issue:
I’ve been struggling to have a browser drop-in version working (without Node). I updated webpack.config.js accordingly.
I set react in externals so the compiled version looks for React instead of including it when it is required. (React doesn’t handle being required more than once)
In my app: Uncaught TypeError: Cannot read property 'getPooled' of null: lib/Surface.js#L49
React libs (i.e. invariant & ReactUpdates) are meant to be required when needed (like you guys do) and aren’t defined on the global scope (thus no externals), so when building I let them as-is to be included in dist/react-canvas.js, yet something seems wrong for ReactUpdates.ReactReconcileTransaction is always undefined.
I’m positive that both version of React (my app & the one used to include react/lib/* in the distribution) are the same (0.13.0-rc1).
Teh question:
You who’ve been digging a lot into the core of React, do you see something obvious (or less so) that I’m missing? Is a browser-ready version something you’ve considered?
Hackish solution
I finally have a version that works!
I’ve removed React from my app and bundled it inside dist/react-canvas.js (a little bit like react-with-addons.js). For it to work though, I have to manually (post-building) add window.React = React so that dist/react-canvas.js exposes both React and ReactCanvas
🤘
The text was updated successfully, but these errors were encountered:
tl;dr
Woah, sorry this turned out to be a longer issue than I expected. I have a solution but it requires manual editing of a compiled file… 👎
Issue:
I’ve been struggling to have a browser drop-in version working (without Node). I updated
webpack.config.js
accordingly.I set
react
in externals so the compiled version looks forReact
instead of including it when it is required. (React doesn’t handle being required more than once)In my app:
Uncaught TypeError: Cannot read property 'getPooled' of null
: lib/Surface.js#L49React libs (i.e.
invariant
&ReactUpdates
) are meant to be required when needed (like you guys do) and aren’t defined on the global scope (thus noexternals
), so when building I let them as-is to be included indist/react-canvas.js
, yet something seems wrong forReactUpdates.ReactReconcileTransaction
is alwaysundefined
.I’m positive that both version of React (my app & the one used to include
react/lib/*
in the distribution) are the same (0.13.0-rc1).Teh question:
You who’ve been digging a lot into the core of React, do you see something obvious (or less so) that I’m missing? Is a browser-ready version something you’ve considered?
Hackish solution
I finally have a version that works!
I’ve removed
React
from my app and bundled it insidedist/react-canvas.js
(a little bit likereact-with-addons.js
). For it to work though, I have to manually (post-building) addwindow.React = React
so thatdist/react-canvas.js
exposes bothReact
andReactCanvas
🤘
The text was updated successfully, but these errors were encountered: