@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.
Monorepo World: October 7, 2024Monorepo World: October 7, 2024Join 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}
201nx run acme:serve
2This 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 },
19Target which builds the application.
4200Port to listen on.
trueRead buildable libraries from source instead of building them separately.
Target which builds the custom server.
Enable HTTPS support for the custom server.
trueServe the application in the dev mode.
Enable HTTPS support for the Next.js development server.
Path to a HTTPS key file.
Path to a HTTPS certificate file.
Path to a HTTPS certificate authority file.
Hostname on which the application is served.
Max milliseconds to wait before closing inactive connection.
falseHide error messages containing server information.
falseStatic markup.
Activate the incremental bundler for Next.js, which is implemented in Rust. Please note, this feature is exclusively available in development mode.