docs: fix LOAD_AS_FILE in cjs high-level doc
Hey folks. I've been re-implementing cjs external to node and fixing this one point in particular would have saved some bugs.
this pr breaks up LOAD_AS_FILE into 2 stages. LOAD_AS_FILE only finds an exact file. LOAD_AS_FILE_EXT finds the file with supported file extension types added.
the implementation is here https://github.com/nodejs/node/blob/master/lib/internal/modules/cjs/loader.js#L283 reading the directory is done before scanning for files by extension but after exact match checking.
this behavior is covered by the test https://github.com/nodejs/node/blob/master/test/parallel/test-require-extensions-same-filename-as-dir.js
Checklist
-
documentation is changed or added -
commit message follows commit guidelines