kevinohara80 / nforce

nforce is a node.js salesforce REST API wrapper for force.com, database.com, and salesforce.com
MIT License
474 stars 167 forks source link

Any plans to support React Native? #103

Closed rgoldiez closed 8 years ago

rgoldiez commented 8 years ago

I've been using nforce in a couple of node.js apps and it works great. Any plans to support React Native? I've tried the simple var nforce = require('nforce') and React Native throws a bunch of dependency errors (no, simply installing the dependencies doesn't resolve it). See below for one such error:

simulator screen shot nov 29 2015 6 48 12 pm

kevinohara80 commented 8 years ago

Interesting. querystring is a native node module so it would need to be replaced along with any other native node modules to make it work without a compilation step. Can't you use something like browserify to create a web-safe bundle?

kevinohara80 commented 8 years ago

From what I've read, you would probably want to use React Packager....

https://github.com/facebook/react-native/blob/master/packager/README.md

...although packager doesn't seem to have a web-safe fallback system like Browserify or Webpack. Related issue...

https://github.com/facebook/react-native/blob/master/packager/README.md

querystring is just one issue to resolve. Any dependencies and sub-dependencies all the way down the dependency tree needs to be addressed. For example, nforce relies heavily on request which leverages many node-core modules like stream.

This is where Browserify and Webpack shine. They fix this for you when you create your bundles. I'm not sure how Webpack does this but Browserify has a fallback system to compatible npm modules when it can.

I'm thinking that the solution might be to "build" nforce into a bundle that doesn't rely on any node core modules.

@duncanfinney might have some ideas.

rgoldiez commented 8 years ago

@kevinohara80 - I agree with your last post. I tried crawling the dependencies and sub-dep tree and it's a rat hole. An nforce bundle that doesn't rely on core node would be great ... even if it was a slim down version just to get rolling.

rgoldiez commented 8 years ago

Closing this issue. Salesforce mobile SDK 4.0 supports react native.