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)
- (node:23249) [DEP0040] DeprecationWarning: The `punycode` module is deprecated. HOT 2
- TypeError: _reactNative.AccessibilityInfo.announceForAccessibilityWithOptions is not a function HOT 2
- Touch events not responding, scroll events only working, app freezing, etc. HOT 5
- how to skip bundling js and assets when assemble android release build? HOT 4
- Autocomplete Failure in React Native TextInput with multiline={true} Prop (TextInput) HOT 2
- [!] Failed to load 'hermes-engine' podspec: [!] Invalid `hermes-engine.podspec` file: [!] Unable to locate the executable `cmake`. HOT 3
- [!] Failed to load 'hermes-engine' podspec: [!] Invalid hermes-engine.podspec file: [!] Unable to locate the executable cmake. HOT 5
- [0.74][iOS] Wrong state of Touchable components with React.Suspense on New Architecture HOT 10
- [!] Invalid hermes-engine.podspec file: [!] Unable to locate the executable cmake. HOT 8
- Android native module rejections are not instanceof Error HOT 1
- Could not find com.facebook.react:react-android:.:0.72.1 HOT 9
- Build issues with 0.71 RNSha256 XCode 15.3 HOT 4
- `fontVariant` doesn't work on iOS when using the new architecture
- UI problem with iOS floating keyboard in iPad. HOT 6
- TouchableWithoutFeedback does not support style HOT 1
- Cannot find EventEmitter for receivedTouches EventName[topTouchMove, topTouchEnd] on native library HOT 5
- RCTNativeAnimatedNodesManager.mm props is not a node HOT 1
- Unexpected scroll behaviors when using FlatList HOT 7
- When I integration react native with Existing Android Apps,I got a autolinking question. HOT 2
- Symbol not found: (_JSGlobalContextSetInspectable) HOT 2
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.