Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Packager] Feature request: Support for patching global apis #2238

Closed
uber5001 opened this issue Aug 5, 2015 · 5 comments
Closed

[Packager] Feature request: Support for patching global apis #2238

uber5001 opened this issue Aug 5, 2015 · 5 comments
Labels
Resolution: Locked This issue was locked by the bot.

Comments

@uber5001
Copy link

uber5001 commented Aug 5, 2015

It would be convenient to be able to fill in any gaps in the JavaScriptCore environment with custom patches, so that any dependencies that expect to be running in v8 with node.js APIs can function properly.

url is one of the modules exposed by the Node.js APIs. require('url') doesn't seem to work within React Native. There's also a module on npm called url that is meant to be a browserify replacement for node's url. I want to be able to use this as a replacement for Node's url.

For most cases, just npm install url will fix the problem. This even fixes my issue directly, which is that one of my sub-dependencies is url. This falls apart when my dependency that depends of url gets de-duped by npm when the module I'm working on gets installed by someone else. (Let me know if I need to explain this in detail)

I'm not sure how this would be exposed. Perhaps something along the lines of

require('react-native').patchModule('url', require('url'));

which would cause all require('url') to use the globally patched version provided.

@browniefed
Copy link
Contributor

There was a proposal for the packager to read the package.json to get modules you specify for react-native specifically.

@uber5001
Copy link
Author

uber5001 commented Aug 6, 2015

@browniefed, do you have a link to the proposal? I can't seem to find it.

@browniefed
Copy link
Contributor

@uber5001 my memory is failing me.
However I think it may have been #1871
Which links to this package over here https://github.com/tradle/react-native-level-fs

The concept being

{
    ...
    "react-native": {
       "url": "react-native-level-fs" 
    }
    ...
}

@browniefed
Copy link
Contributor

@uber5001 found it #2208

@brentvatne brentvatne changed the title Feature request: Support for patching global apis [Packager] Feature request: Support for patching global apis Sep 13, 2015
@brentvatne
Copy link
Collaborator

#2208 seems to cover this nicely, great call @browniefed. @uber5001 ping me if that's not the case

@facebook facebook locked as resolved and limited conversation to collaborators Jul 22, 2018
@react-native-bot react-native-bot added the Resolution: Locked This issue was locked by the bot. label Jul 22, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Resolution: Locked This issue was locked by the bot.
Projects
None yet
Development

No branches or pull requests

4 participants