reselect icon indicating copy to clipboard operation
reselect copied to clipboard

Add browser compatible version

Open izelnakri opened this issue 10 years ago • 6 comments

1 - when I npm install reselect npm gave me a peer dependency error for react-redux. I dont use react for my project and thankfully reselect library works without the react dependency. Please remove this dependency error from the npm dependency declarations.

2 - Please provide a bundled non ES6 version of the library, so people can also download them without ever needing an ES6 transpiler. the whole code base isn't that big. Ideally every function could be namespaced to Reselect global var. Example: Reselect.createSelector();

thank you for creating an awesome library, please make sure it's accessible to non-react-hipsters too ;)

The example project that uses reselect without react is here: https://github.com/izelnakri/riotjs-experiment

izelnakri avatar Mar 24 '16 23:03 izelnakri

Hi @izelnakri

  1. I'm confused, Reselect has no dependency on React Redux. In fact, Reselect has zero dependencies, so there is nothing to remove.

  2. There is a ES5 version of the source in the lib folder when you download via npm. Or are you asking for something else?

ellbee avatar Mar 25 '16 10:03 ellbee

Hi @ellbee, thanks for the quick answer!

yep, I created a new project to test this time npm didnt give me the react-redux dependency error. Sorry, nevermind the first issue.

On the second issue: there is no browser-compatible version of the library. ES5 version isn't ES5, it is ES5 + CommonJS. Would be great to have the library hosted at least on one CDN, have a bundled/browser-compatible version of the library like Redux: https://cdnjs.com/libraries/redux.

index_js_ _lib_ __users_izelnakri_riotjs-experiment

izelnakri avatar Mar 25 '16 11:03 izelnakri

Ah ok, I see what you mean. There was an issue about this here: #29. I have no use for this so I won't be adding it myself, but I would welcome a PR.

ellbee avatar Mar 25 '16 11:03 ellbee

I've had this need a few times, I'd be happy to contribute a PR. The easiest thing to do would probably be to introduce a dev dependency for creating a UMD bundle. Any preference there? If there are no objections, I could model it after Redux which uses Webpack for the UMD builds: https://github.com/reactjs/redux/blob/master/webpack.config.js

npbee avatar Apr 16 '16 14:04 npbee

@npbee That's great, thank you!

I don't have an objection to Webpack, but as Reselect is just a single file is it overkill? Can we just use a babel transform? I have no idea what I am talking about when it comes to UMD so forgive me if this is a silly question!

ellbee avatar Apr 16 '16 21:04 ellbee

Not silly at all! There is a babel transform for UMD, so I'll check that out first. I agree that Webpack feels like overkill. I think if we just use a babel transform we won't really get a "production-ready" UMD build with minification and all that, but it doesn't seem like that's really the use case for the UMD build here so I don't think it's absolutely necessary right now.

npbee avatar Apr 16 '16 21:04 npbee