@nx/next:server
Serve a Next.js app.
Options can be configured in project.json
when defining the executor, or when invoking it. Read more about how to configure targets and executors here: https://nx.dev/reference/project-configuration#targets.
The State of JS survey is live, featuring a monorepo tools sectionThe State of JS survey is live, featuring a monorepo tools sectionVote for us
Serve a Next.js app.
Options can be configured in project.json
when defining the executor, or when invoking it. Read more about how to configure targets and executors here: https://nx.dev/reference/project-configuration#targets.
project.json
:
1//...
2{
3 "name": "acme",
4 "$schema": "node_modules/nx/schemas/project-schema.json",
5 "sourceRoot": ".",
6 "projectType": "application",
7 "targets": {
8 //...
9 "serve": {
10 "executor": "@nx/next:server",
11 "defaultConfiguration": "production",
12 "options": {
13 "buildTarget": "acme:build",
14 "dev": true
15 }
16 }
17 //...
18 }
19}
20
1nx run acme:serve
2
This is the default configuration for Next.js standalone projects. Our @nx/next:server
executor is integrated to use Next.js' CLI. You can read more about the serve options at Next.js CLI Options
1 "serve": {
2 "executor": "@nx/next:server",
3 "defaultConfiguration": "development",
4 "options": {
5 "buildTarget": "acme:build",
6 "dev": true
7 },
8 "configurations": {
9 "development": {
10 "buildTarget": "acme:build:development",
11 "dev": true
12 },
13 "production": {
14 "buildTarget": "acme:build:production",
15 "dev": false
16 }
17 }
18 },
19
Target which builds the application.
4200
Port to listen on.
true
Read buildable libraries from source instead of building them separately.
Target which builds the custom server.
true
Serve the application in the dev mode.
Hostname on which the application is served.
Max milliseconds to wait before closing inactive connection.
false
Hide error messages containing server information.
false
Static markup.
Activate the incremental bundler for Next.js, which is implemented in Rust. Please note, this feature is exclusively available in development mode.