Skip to content

Commit

Permalink
Fix a typo in docs on data fetching
Browse files Browse the repository at this point in the history
While reading the docs, I stumbled over this phrasing. It seems to have been introduced with the [whole section](https://nextjs.org/docs/basic-features/data-fetching#reading-files-use-processcwd) on _Reading files: Use `process.cwd()`_ with vercel#11084.
  • Loading branch information
DerGut committed Jan 4, 2022
1 parent cfa8ab9 commit 609693e
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion docs/basic-features/data-fetching.md
Expand Up @@ -323,7 +323,7 @@ Files can be read directly from the filesystem in `getStaticProps`.

In order to do so you have to get the full path to a file.

Since Next.js compiles your code into a separate directory you can't use `__dirname` as the path it will return will be different from the pages directory.
Since Next.js compiles your code into a separate directory you can't use `__dirname` as the path. It will be different from the pages directory.

Instead you can use `process.cwd()` which gives you the directory where Next.js is being executed.

Expand Down

0 comments on commit 609693e

Please sign in to comment.