@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.
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
:
//...
{
"name": "acme",
"$schema": "node_modules/nx/schemas/project-schema.json",
"sourceRoot": ".",
"projectType": "application",
"targets": {
//...
"serve": {
"executor": "@nx/next:server",
"defaultConfiguration": "production",
"options": {
"buildTarget": "acme:build",
"dev": true
}
}
//...
}
}
nx run acme:serve
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
"serve": {
"executor": "@nx/next:server",
"defaultConfiguration": "development",
"options": {
"buildTarget": "acme:build",
"dev": true
},
"configurations": {
"development": {
"buildTarget": "acme:build:development",
"dev": true
},
"production": {
"buildTarget": "acme:build:production",
"dev": false
}
}
},
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.
Path to the proxy configuration file.
Use the built-in rewrite feature from Next.js. See: https://nextjs.org/docs/api-reference/next.config.js/rewrites