[How To] Change where Next.js looks for pages directory
Next.js is a React framework for rapid development. I tried it for almost a month. I will write a blog post on that separately.
By default Next.js searches for pages in the project root directory. There is a way to tell next to look for pages in different directory. The solution were copied from the github issue from next.js and credit goes to github user brainkim
$ next ./src
$ next dev ./src
$ next build ./src
$ next start ./src -p 8080
Here, next ./src
– will start next client on src folder.
next build ./src
– This instruct next.js to look for pages inside src
directory
next start ./src -p 8080
– This instructs next.js to start server on src directory with port 8080.
I spent almost more than an hour trying to figure out the solution. Hope this comes handy to some people.