@nx/next:build
Build 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.
Webinar April 17: Making the Argument for MonoreposWebinar April 17: Making the Argument for MonoreposRegister now!
Build 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 "build": {
10 "executor": "@nx/next:build",
11 "outputs": ["{options.outputPath}"],
12 "defaultConfiguration": "production",
13 "options": {
14 "outputPath": "dist/acme"
15 }
16 }
17 //...
18 }
19}
20
1nx run acme:build
2
This is the default configuration for Next.js standalone projects. Our @nx/next:build
executor is integrated to use Next.js' CLI. You can read more about the build options at Next.js CLI Options
1 "build": {
2 "executor": "@nx/next:build",
3 "outputs": ["{options.outputPath}"],
4 "defaultConfiguration": "production",
5 "options": {
6 "outputPath": "dist/acme"
7 },
8 "configurations": {
9 "development": {
10 "outputPath": "."
11 },
12 "production": {}
13 }
14 },
15
The output path of the generated files.
Path (relative to workspace root) to a function which takes phase, config, and builder options, and returns the resulting config. This is an advanced option and should not be used with a normal Next.js config file (i.e. next.config.js
).
true
Read buildable libraries from source instead of building them separately.
Enable Next.js debug build logging
Only build 'app' routes
[]
Replace files with other files in the build.
false
Include devDependencies
in the generated package.json file. By default only production dependencies
are included.
Used to enable React Production Profiling
false
Generate a lockfile (e.g. package-lock.json) that matches the workspace lockfile to ensure package versions match.