facebook / relay

Relay is a JavaScript framework for building data-driven React applications.
https://relay.dev
MIT License
18.4k stars 1.82k forks source link

All symlinked files are ignored #4815

Open dr3 opened 1 week ago

dr3 commented 1 week ago

Issue

All files that are symlinked are ignored by relay-compiler.

This includes files found via src in single project repos and generatedSources in multi project repos

This means that while its common to exclude "**/node_modules/**", if you dont want to, and use pnpm (which uses symlinks) its impossible for relay to discover your files

Expected behaviour

Either by default, or via a flag, relay compiler sees and resolves symlinked files as if they were standard files

lynnshaoyu commented 1 week ago

Hey @dr3 did you just notice this behavior starting recently or has it been persisting for a long time?

dr3 commented 1 week ago

Hey @dr3 did you just notice this behavior starting recently or has it been persisting for a long time?

@lynnshaoyu Ive tested on 14.1.0 and 18.1.0 and it happens on both

Im testing via referencing a fragment in a node_module by name and getting Undefined fragment ... error

Then running this is to replace symlinks with actual files

cp -Lr node_modules/@component-library/apple node_modules/@component-library/appleCopy && rm node_modules/@component-library/apple && mv node_modules/@component-library/appleCopy node_modules/@component-library/apple

And the error disappears

net commented 1 week ago

Does node-linker=hoisted fix the problem?

https://pnpm.io/npmrc#node-linker