Closed aleclarson closed 7 years ago
Thanks for the input! Sorry for getting back so late, I totally didn't see this.
module.exports = require('../../node_modules/path-browserify');
Why not module.exports = require('path-browserify');
?
WDYT? Is this not preferable?
You'd have to create a Haste module per node built-in module. I guess that's not a big deal, could easily automate it. You don't even have to clone react-native from git, you could just patch it inside your node_modules/
folder.
In the end, the ReactNativify approach is pretty lightweight. A small babel transform, an additional transform.js
file, and a rn-cli.config.js
file. No patches necessary, no extra files you need to ensure are always there, plus slightly smaller generated code. And if React Native ever gives up Haste, at least for the Open Source port, this approach will continue to work.
@philikon Interesting stuff, thanks!
If you install any polyfills into the
react-native
package, you can avoid overriding the transformer.Set the contents of
Libraries/NodeJS/path.js
to:WDYT? Is this not preferable?