dustingetz / react-cursor

Immutable state for React.js
1.03k stars 50 forks source link

commonjs build does not work from a script tag #50

Closed dustingetz closed 9 years ago

dustingetz commented 9 years ago

The production file needs to detect when it is used from a script tag (instead of a module loader) and export window.Cursor global.

dustingetz commented 9 years ago

https://github.com/dustingetz/react-cursor/pull/3

dustingetz commented 9 years ago

@damassi do you know how to fix this quickly?

damassi commented 9 years ago

Sure, I can take care of it in about an hour, when I get into the office

dustingetz commented 9 years ago

Thanks. Here is my attempt, in which react-cursor throws "Uncaught Error: Cannot find module 'react/addons'"

https://github.com/dustingetz/react-cursor/compare/djg/fix-standalone

dustingetz commented 9 years ago

I think what I missed is that react needs to be shimmed

damassi commented 9 years ago

ah cool, so you got it?

damassi commented 9 years ago

either way, i'm about to commit a PR that swaps out browserify for webpack that simplifies things quite substantially and exports a UMD target.

dustingetz commented 9 years ago

Not resolved yet - yes, please for the PR - thank you so much!

damassi commented 9 years ago

np

damassi commented 9 years ago

Ok, @dustingetz -- be prepared for a big PR. I replaced browserify and grunt with webpack, cleaned up your test structure and karma configuration, cleaned up the example structure and moved each over to webpack-hot-reloader so that users can take advantage when experimenting, and generally just simplified overall. I'll write a more thorough overview in the PR, but don't want to surprise you when you get the request!

dustingetz commented 9 years ago

Hit me. You're the man Christopher, thanks!

On Tue, Aug 11, 2015 at 4:57 PM, Christopher Pappas < notifications@github.com> wrote:

Ok, @dustingetz https://github.com/dustingetz -- be prepared for a big PR. I replaced browserify and grunt with webpack, cleaned up your test structure and karma configuration, cleaned up the example structure and moved each over to webpack-hot-reloader so that users can take advantage when experimenting, and generally just simplified overall. I'll write a more thorough overview in the PR, but don't want to surprise you when you get the request!

— Reply to this email directly or view it on GitHub https://github.com/dustingetz/react-cursor/issues/50#issuecomment-130071468 .

damassi commented 9 years ago

See https://github.com/dustingetz/react-cursor/pull/52