mikehardy/jetifier

readDir Infinite loop

gaodeng opened this issue · 3 comments

When there is a symlink to the parent folder in the node_modules folder, it will loop indefinitely.

filesList = readDir(filePath, filesList);

Interesting, I was not aware react-native tools (metro etc) handled symlinks?

Try a patch where you do readDir but with options set to withFileTypes
https://nodejs.org/api/fs.html#fs_fs_readdir_path_options_callback

Then only recur if it isSymblicLink is false
https://nodejs.org/api/fs.html#fs_class_fs_dirent
https://nodejs.org/api/fs.html#fs_dirent_issymboliclink

You can hack on it right in node_modules to test, work of a couple minutes. If it works use patch-package to generate a patch so you are fixed locally and submit a PR, I'll merge it in

@mikehardy metro can not handled symlinks . I am manually add symlink package to watchFolders in metro.config.js .
here the PR #56

resolved in v1.6.5