Comments (8)
Isn't module system supposed to take browser
“redirects” into account as specified in package.json
? I think it's the reason I didn't have this problem with Webpack:
(from superagent's package.json:)
"browser": {
"./lib/node/index.js": "./lib/client.js",
"emitter": "component-emitter",
"reduce": "reduce-component"
},
"main": "./lib/node/index.js",
React Native's bundler doesn't seem to look at these.
Which triggers another question: why does RN use its own bundler instead of Webpack or Browserify? There may be other potential issues lurking in there, already solved by existing bundlers. There is an entire ecosystem of transformers, including support for AMD or ES6 or transpile-to-JS languages.
Shouldn't we leverage this by default?
from react-native.
We're still unclear about this. We're trying to be very deliberate in the dependencies that we add inside of core.
You can use fetch, the new w3c api in order to do data fetching. We also have xhr implemented.
For node modules like events
, this is unclear. I wish that we could push events to npm instead of having it inside of react native directly.
from react-native.
Would love to get your point of view on this subject
from react-native.
I had a little more luck by using the browser build of superagent but it seems there's more of xhr that hasn't been ported yet that trips superagent up. Personally I'd love to see superagent supported as I already use it on the client and server and would be great if all that code could be shared. I'll see if I can work on Libraries/XMLHttpRequest/XMLHttpRequest.ios.js to get superagent working.
from react-native.
I answered this in another thread #5 (comment)
from react-native.
This is still a problem, isn't it? Would RN packager plan to fix this? Thanks 👍
from react-native.
Hi!
You can try 'superagent/lib/client' but you need to modify require statements at the top of file:
var Emitter = require('component-emitter');
var reduce = require('reduce-component');
Because React Native doesn't correctly handle 'browser' section in package.json.
Also you can try my fork that is work with React Native:
https://github.com/philipshurpik/superagent
It has some other little fixes... Mainly default content type fix - set "application/json" as default, because react native xhr request doesn't correctly handle it.
from react-native.
The packager now looks at the browser
field. superagent should be usable once they publish a new version following this PR ladjs/superagent#621 which just makes it not depend on a location
object on the global object.
from react-native.
Related Issues (20)
- [iOS][Information] App store submissions will require a privacy manifest and signature for hermes HOT 3
- Cookies not being sent to webview for iOS after React Native Upgrade HOT 4
- [0.74] Cannot access Dev Menu on Android (RNTester) HOT 4
- TextInput contextMenuHidden does not hide autofill HOT 1
- Showing Recent Messages Command PhaseScriptExecution failed with a nonzero exit code HOT 3
- Unknown unicode characters in Image source broken on iOS in New Architecture HOT 1
- TouchableWithoutFeedback crashes when SVG component is a direct child of it HOT 2
- FBReactNativeSpec build commands failed with RN 0.71.4 / Xcode 15.3 / M2 HOT 6
- error `fsevents` unavailable (this watcher can only be used on Darwin) HOT 2
- `@synthesize bridge = _bridge` not working with bridgeless mode and TurboModule
- No bundle url is present when run ios app on real iphone device HOT 3
- The application is slow after running for a long time without being used HOT 3
- Could not determine the dependencies of null. > Could not resolve all task dependencies for configuration ':classpath'. > Could not find com.facebook.react:react-native-vector-icons:10.0.3. HOT 5
- Could not find or use auto-linked framework 'CoreAudioTypes': framework 'CoreAudioTypes' not found HOT 2
- Unable to build with XCode 15 HOT 2
- Header height not getting calculated in pageY value for components in new architecture HOT 1
- This issue was closed because it has been stalled for 7 days with no activity. HOT 3
- The Linking does not open an external application HOT 8
- Cannot find module @react-native/codegen/lib/cli/combine/combine-js-to-schema-cli.js HOT 4
- v7 Navigating back randomly causes NAVIGATE action to be dispatched instead of GO_BACK HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from react-native.