tradle / rn-nodeify

hack to allow react-native projects to use node core modules, and npm modules that use them
MIT License
614 stars 114 forks source link

pbkdf2 hack breaks the lib #104

Closed Fubinator closed 3 years ago

Fubinator commented 3 years ago

The hack replaces process.version with the actual version of the process, however there is a global.process.version which is replaced to global."ACTUAL VERSION", which breaks.

The default-encoding.js gets hacked to:

var defaultEncoding
/* istanbul ignore next */
if (global.process && global.process.browser) {
  defaultEncoding = 'utf-8'
} else if (global.process && global."v15.12.0") {
  var pVersionMajor = parseInt(process.version.split('.')[0].slice(1), 10)

  defaultEncoding = pVersionMajor >= 6 ? 'utf-8' : 'binary'
} else {
  defaultEncoding = 'utf-8'
}
module.exports = defaultEncoding

Reproduction (just clone, install deps, and run): https://github.com/Fubinator/react-native-userbase-poc

mvayngrib commented 3 years ago

@Fubinator can u check if this solves your issue? https://github.com/tradle/rn-nodeify/pull/103#discussion_r610956927

Fubinator commented 3 years ago

Yep, that works, thank you! Sorry that I didn't check the repo for that issue properly. Are you planning to merge that? Feel free to close this issue.

mvayngrib commented 3 years ago

@Fubinator i've yet to test it myself, want to make a PR?

Fubinator commented 3 years ago

Sure, I'm gonna try making the PR tomorrow!