facebook / facebook/flow

Flow does not find files behind a symbolic link directory path

Open
#4,015 14 comments 29 reactions 0 assignees View on GitHub
Windows support
Dominant language
Rust
Stars
22.3k
Forks
1.9k
PR merge metrics
No merged PRs in 30d

Description

Flow: 0.46
Platform: Windows 10 (git-bash)

TL;DR: Files in a symlinked directory are not found, Flow does not seem to follow symlinks at least on Windows.

Tiny test project: [**Test.zip**](https://github.com/facebook/flow/files/1027392/Test.zip)

**WARNING:** The ZIP included the sym-linked directory as full directory! Remove `Test/src/system/` and create a symlink with (on Windows) `mklink /D system nodejs` inside `Test/src/`. If you just unzip it and run Flow there are no errors - obviously.

I use a symbolic link to link to one of my three directories with platform-dependent code (nodejs, browser, react-native). They all have the exact same files and API, just the platform-dependent part of the implementation.

Then I created a symbolic link named `system` pointing to the directory with the platform-dependent files. Before that I had `./nodejs/someFile.js` in all `require('...')` commands and used a build process to replace the "nodejs" with whatever platform the build was for.

So after switching to this much cleaner method (no code rewrites) Flow gives me a `Required module not found` error for each one of the imports that look similar to `require('./system/storage-base.js');` (before it was `require('./nodejs/storage-base.js');` in the `src/` directory and "nodejs" replaced after build in the `lib/` directory).

WebStorm has no problem with the symlink (just an aside).

I found #149 but that was closed by the author without giving a reason.

Also: https://github.com/facebook/flow/issues/46#issuecomment-64593695

And also https://github.com/facebook/flow/issues/164 -- this sounds as if it should work when the Flow server is restarted and that only watching for changes is the issue, but I did restart `flow.exe` and it made no difference.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.