This PR ensures that `overrides` and `resolutions` are in the generated package.json file as well. If they are missing, then using `--frozen-lockfile` will fail due to mismatched overrides in the lockfile. Also adds a `skipOverrides` flag to the affected executors and plugins -- same as `skipPackageManger` that was added previously. Affected executors/plugins: - `@nx/vite:build` - `@nx/webpack:webpack` - `@nx/remix:build` - `@nx/next:build` - `NxAppWebpackPlugin` <!-- Example: `fix(nx): must begin with lowercase` --> <!-- If this is a particularly complex change or feature addition, you can request a dedicated Nx release for this pull request branch. Mention someone from the Nx team or the `@nrwl/nx-pipelines-reviewers` and they will confirm if the PR warrants its own release for testing purposes, and generate it for you if appropriate. --> ## Current Behavior <!-- This is the behavior we have today --> ## Expected Behavior <!-- This is the behavior we should expect with the changes in this PR --> ## Related Issue(s) <!-- Please link the issue being fixed so it gets closed when this is merged. --> Fixes #26884
100 lines
7.0 KiB
JSON
100 lines
7.0 KiB
JSON
{
|
|
"name": "build",
|
|
"implementation": "/packages/next/src/executors/build/build.impl.ts",
|
|
"schema": {
|
|
"version": 2,
|
|
"outputCapture": "pipe",
|
|
"$schema": "https://json-schema.org/schema",
|
|
"cli": "nx",
|
|
"title": "Next Build",
|
|
"description": "Build a Next.js app.",
|
|
"type": "object",
|
|
"properties": {
|
|
"outputPath": {
|
|
"type": "string",
|
|
"description": "The output path of the generated files.",
|
|
"x-completion-type": "directory",
|
|
"x-priority": "important"
|
|
},
|
|
"fileReplacements": {
|
|
"description": "Replace files with other files in the build.",
|
|
"type": "array",
|
|
"items": {
|
|
"type": "object",
|
|
"properties": {
|
|
"replace": {
|
|
"type": "string",
|
|
"description": "The file to be replaced.",
|
|
"x-completion-type": "file"
|
|
},
|
|
"with": {
|
|
"type": "string",
|
|
"description": "The file to replace with.",
|
|
"x-completion-type": "file"
|
|
}
|
|
},
|
|
"additionalProperties": false,
|
|
"required": ["replace", "with"]
|
|
},
|
|
"default": []
|
|
},
|
|
"nextConfig": {
|
|
"description": "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`).",
|
|
"type": "string",
|
|
"x-completion-type": "file",
|
|
"x-completion-glob": "next?(*).js",
|
|
"x-priority": "important"
|
|
},
|
|
"buildLibsFromSource": {
|
|
"type": "boolean",
|
|
"description": "Read buildable libraries from source instead of building them separately.",
|
|
"default": true
|
|
},
|
|
"includeDevDependenciesInPackageJson": {
|
|
"type": "boolean",
|
|
"description": "Include `devDependencies` in the generated package.json file. By default only production `dependencies` are included.",
|
|
"default": false
|
|
},
|
|
"generateLockfile": {
|
|
"type": "boolean",
|
|
"description": "Generate a lockfile (e.g. package-lock.json) that matches the workspace lockfile to ensure package versions match.",
|
|
"default": false,
|
|
"x-priority": "internal"
|
|
},
|
|
"skipOverrides": {
|
|
"type": "boolean",
|
|
"description": "Do not add a `overrides` and `resolutions` entries to the generated package.json file. Only works in conjunction with `generatePackageJson` option."
|
|
},
|
|
"skipPackageManager": {
|
|
"type": "boolean",
|
|
"description": "Do not add a `packageManager` entry to the generated package.json file."
|
|
},
|
|
"debug": {
|
|
"type": "boolean",
|
|
"description": "Enable Next.js debug build logging"
|
|
},
|
|
"profile": {
|
|
"type": "boolean",
|
|
"description": "Used to enable React Production Profiling"
|
|
},
|
|
"experimentalAppOnly": {
|
|
"type": "boolean",
|
|
"description": "Only build 'app' routes"
|
|
},
|
|
"experimentalBuildMode": {
|
|
"type": "string",
|
|
"description": "Change the build mode.",
|
|
"enum": ["compile", "generate"]
|
|
}
|
|
},
|
|
"required": ["outputPath"],
|
|
"examplesFile": "---\ntitle: Next.js builder executor examples\ndescription: This page contains examples for the @nx/next:build executor.\n---\n\n`project.json`:\n\n```json\n//...\n{\n \"name\": \"acme\",\n \"$schema\": \"node_modules/nx/schemas/project-schema.json\",\n \"sourceRoot\": \".\",\n \"projectType\": \"application\",\n \"targets\": {\n //...\n \"build\": {\n \"executor\": \"@nx/next:build\",\n \"outputs\": [\"{options.outputPath}\"],\n \"defaultConfiguration\": \"production\",\n \"options\": {\n \"outputPath\": \"dist/acme\"\n }\n }\n //...\n }\n}\n```\n\n```bash\nnx run acme:build\n```\n\n## Examples\n\n### For Next.js Standalone projects\n\n{% tabs %}\n{% tab label=\"Default configuration\" %}\n\nThis 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](https://nextjs.org/docs/app/api-reference/next-cli)\n\n```json\n \"build\": {\n \"executor\": \"@nx/next:build\",\n \"outputs\": [\"{options.outputPath}\"],\n \"defaultConfiguration\": \"production\",\n \"options\": {\n \"outputPath\": \"dist/acme\"\n },\n \"configurations\": {\n \"development\": {\n \"outputPath\": \".\"\n },\n \"production\": {}\n }\n },\n```\n\n{% /tab %}\n{% tab label=\"Enable debug\" %}\n\nYou can create a debug build for more verbose output by:\n\nUsing the `--debug` flag\n\n```shell\nnx run acme:build:development --debug\n```\n\nUpdating the build options to include `debug`.\n\n```json\n \"build\": {\n \"executor\": \"@nx/next:build\",\n \"outputs\": [\"{options.outputPath}\"],\n \"defaultConfiguration\": \"production\",\n \"options\": {\n \"outputPath\": \"dist/acme\"\n },\n \"configurations\": {\n \"development\": {\n \"outputPath\": \".\",\n \"debug\": true\n },\n \"production\": {}\n }\n },\n```\n\n```bash\nnx run acme:build:development\n```\n\n{% /tab %}\n\n{% tab label=\"Adding profiling\" %}\n\nYou can enable profiing for React by\n\nUsing the `--profile` flag\n\n```shell\nnx run acme:build:production --profile\n```\n\nUpdating the build options to include `profile`.\n\n```json\n \"build\": {\n \"executor\": \"@nx/next:build\",\n \"outputs\": [\"{options.outputPath}\"],\n \"defaultConfiguration\": \"production\",\n \"options\": {\n \"outputPath\": \"dist/acme\"\n },\n \"configurations\": {\n \"development\": {\n \"outputPath\": \".\",\n },\n \"production\": {\n \"profile\": true\n }\n }\n },\n```\n\n```shell\nnx run acme:build:production\n```\n\n{% /tab %}\n\n{% tab label=\"Enable experimental app only\" %}\n\nSince Next.js 13 the `app/` directory it is reserved.\nYou can enable to build only `app/` routes by\n\nUsing the `--experimentalAppOnly` flag\n\n```shell\nnx run acme:build:production --experimentalAppOnly\n```\n\nUpdating the build options to include `experimentalAppOnly`.\n\n```json\n \"build\": {\n \"executor\": \"@nx/next:build\",\n \"outputs\": [\"{options.outputPath}\"],\n \"defaultConfiguration\": \"production\",\n \"options\": {\n \"outputPath\": \"dist/acme\"\n },\n \"configurations\": {\n \"development\": {\n \"outputPath\": \".\",\n \"experimentalAppOnly\": true\n },\n \"production\": {}\n }\n },\n```\n\n```shell\nnx run acme:build:production\n```\n\n{% /tab %}\n\n{% /tabs %}\n",
|
|
"presets": []
|
|
},
|
|
"description": "Build a Next.js application.",
|
|
"aliases": [],
|
|
"hidden": false,
|
|
"path": "/packages/next/src/executors/build/schema.json",
|
|
"type": "executor"
|
|
}
|