tradle/rn-nodeify

Error: readFileSync function from `fs` is undefined

JonasHiltl opened this issue · 1 comments

A package that I use uses the fs module to read another file with the readFileSync function. But my app throws an error when calling the readFileSync function, because the function is udefined.
This is the error:

 TypeError: _$$_REQUIRE(_dependencyMap[6], "fs").readFileSync is not a function. (In '_$$_REQUIRE(_dependencyMap[6], "fs").readFileSync(path)', '_$$_REQUIRE(_dependencyMap[6], "fs").rea_dependencyMap[6], "fs").readFileSync' is undefined)

Below is the conflicting line that uses readFileSync

const path = require('path').join(__dirname, 'identity_wasm_bg.wasm');
const bytes = require('fs').readFileSync(path);

These are my node modules I shim:

"postinstall": "rn-nodeify --install fs,util,process,path,events,stream --hack --yarn"

I also import the shim.js file.

yes, readFileSync is not yet supported. PRs welcome here: https://github.com/tradle/react-native-level-fs