Relay compiler fails with "EISDIR: illegal operation on a directory, read" on directories with a dot
- Dominant language
- Rust
- Stars
- 19k
- Forks
- 1.9k
- PR merge metrics
- No merged PRs in 30d
Description
# Repro Steps
1. Create a JS file in a directory with a `.` dot in it.
Example: `routes/advertiser/[aid]/quick-promote.js/quick-promote.a11y.js`
2. Run `relay-compiler`
3. Output:
```
[Error] ERROR:
[Error] EISDIR: illegal operation on a directory, read
[Error] From: CodegenRunner.compileAll
[Error] at Object.readSync (fs.js:592:3)
[Error] at tryReadSync (fs.js:366:20)
[Error] at Object.readFileSync (fs.js:403:19)
[Error] at hashFile (/home/cvuerings/code/pinboard/webapp/node_modules/relay-compiler/bin/relay-compiler:9179:20)
[Error] at /home/cvuerings/code/pinboard/webapp/node_modules/relay-compiler/bin/relay-compiler:9159:23
[Error] at Array.forEach ()
[Error] at updateFiles (/home/cvuerings/code/pinboard/webapp/node_modules/relay-compiler/bin/relay-compiler:9149:15)
[Error] at Object. (/home/cvuerings/code/pinboard/webapp/node_modules/relay-compiler/bin/relay-compiler:9031:12)
[Error] at Generator.next ()
[Error] at asyncGeneratorStep (/home/cvuerings/code/pinboard/webapp/node_modules/relay-compiler/node_modules/@babel/runtime/helpers/asyncToGenerator.js:3:24)
[Error] info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
```
# Issue
`hashFile` receives a directory as the `filename` argument: `routes/advertiser/[aid]/quick-promote.js` and tries to do an `fs.readFileSync` on it.
https://github.com/facebook/relay/blob/86842c141eb59b31269893f224bf24375a2b3539/packages/relay-compiler/codegen/CodegenWatcher.js#L239-L240
Contributor guide
Assessment
This issue has not been assessed yet.