Installing NextJS
As of december 2022 you need node version 14.6 or later to run NextJS.
Automatic installation
yarn create next-app my-app-name --typescript cd my-app-name yarn dev - Starts development server on localhost:3000 yarn build - builds the application for production usage yarn start - starts a Next.js production server
What we will get is
- Automatic compilation and bundling (with webpack and babel)
- React Fast Refresh
- Static generation and server-side rendering of
./pages/
- Static file serving. Everything in
./public/
is mapped to/
Manual installation
For a manual setup have a look at the official docs page.
Installation using Nx
// add the next plugin once yarn add --dev @nrwl/next // create a new nextJs app nx g @nrwl/next:app my-new-app // create a new nextJs page nx g @nrwl/next:page my-new-page --project=my-new-app // create a new nextJs component nx g @nrwl/next:component my-new-component --project=my-new-app
Find more commands on the Nx NextJS plugin doc page.