docs(bundling): correct esbuild options nesting (#28748)
Fixes: - [x] correct nesting of options in ESBuild docs --------- Co-authored-by: Colum Ferry <cferry09@gmail.com>
This commit is contained in:
parent
8bafc3b113
commit
22cec78331
@ -208,7 +208,7 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"additionalProperties": true,
|
"additionalProperties": true,
|
||||||
"examplesFile": "`<app-root>/project.json`:\n\n```jsonc\n{\n //...\n \"targets\": {\n //...\n \"build\": {\n \"executor\": \"@nx/esbuild:esbuild\",\n \"options\": {\n \"main\": \"<app-root>\",\n \"tsConfig\": \"<app-root>/tsconfig.app.json\",\n \"outputPath\": \"dist/<app-root>\"\n }\n }\n }\n}\n```\n\n```bash\nnx build <app-name>\n```\n\n## Examples\n\n{% tabs %}\n{% tab label=\"CommonJS output\" %}\n\nThe CommonJS format is required in some environments, such as Electron applications. By default, `esbuild` will use the ESM format, which is recommended for Web and Node applications. You may also output to multiple formats.\n\n```bash\nnx build <app-name> --format=cjs\nnx build <app-name> --format=esm,cjs\nnx build <app-name> # defaults to es# defaults to esm\n```\n\n```json\n\"build\": {\n \"executor\": \"@nx/esbuild:esbuild\",\n \"options\": {\n \"main\": \"<app-root>\",\n \"tsConfig\": \"<app-root>/tsconfig.app.json\",\n \"outputPath\": \"dist/<app-root>\",\n \"format\": [\"esm\", \"cjs\"]\n}\n```\n\n{% /tab %}\n{% tab label=\"External packages\" %}\n\nYou can avoid packages from being bundled by providing the `external` option with a list of packages to skip.\n\nYou can also use `*` wildcard to match assets.\n\n```json\n\"build\": {\n \"executor\": \"@nx/esbuild:esbuild\",\n \"options\": {\n \"main\": \"<app-root>\",\n \"tsConfig\": \"<app-root>/tsconfig.app.json\",\n \"outputPath\": \"dist/<app-root>\",\n \"external\": [\"lodash\", \"*.png\"]\n}\n```\n\n{% /tab %}\n{% tab label=\"Skip type checking\" %}\n\nType checking is the slowest part of the build. You may want to skip type checking during build and run it as another job in CI.\n\n```json\n\"build\": {\n \"executor\": \"@nx/esbuild:esbuild\",\n \"options\": {\n \"main\": \"<app-root>\",\n \"tsConfig\": \"<app-root>/tsconfig.app.json\",\n \"outputPath\": \"dist/<app-root>\",\n \"skipTypeCheck\": true\n}\n```\n\n{% /tab %}\n{% tab label=\"Additional esbuild options\" %}\n\nAdditional [esbuild options](https://esbuild.github.io/api/) can be passed using `esbuildOptions` in your project configuration.\n\n```json\n\"build\": {\n \"executor\": \"@nx/esbuild:esbuild\",\n \"options\": {\n \"main\": \"<app-root>\",\n \"tsConfig\": \"<app-root>/tsconfig.app.json\",\n \"outputPath\": \"dist/<app-root>\",\n \"esbuildOptions\": {\n \"legalComments\": \"inline\"\n \"banner\": {\n \".js\": \"// banner\"\n },\n \"footer\": {\n \".js\": \"// footer\"\n }\n }\n}\n```\n\n{% /tab %}\n{% tabs %}\n",
|
"examplesFile": "`<app-root>/project.json`:\n\n```jsonc\n{\n //...\n \"targets\": {\n //...\n \"build\": {\n \"executor\": \"@nx/esbuild:esbuild\",\n \"options\": {\n \"main\": \"<app-root>\",\n \"tsConfig\": \"<app-root>/tsconfig.app.json\",\n \"outputPath\": \"dist/<app-root>\"\n }\n }\n }\n}\n```\n\n```bash\nnx build <app-name>\n```\n\n## Examples\n\n{% tabs %}\n{% tab label=\"CommonJS output\" %}\n\nThe CommonJS format is required in some environments, such as Electron applications. By default, `esbuild` will use the ESM format, which is recommended for Web and Node applications. You may also output to multiple formats.\n\n```bash\nnx build <app-name> --format=cjs\nnx build <app-name> --format=esm,cjs\nnx build <app-name> # defaults to es# defaults to esm\n```\n\n```json\n\"build\": {\n \"executor\": \"@nx/esbuild:esbuild\",\n \"options\": {\n \"main\": \"<app-root>\",\n \"tsConfig\": \"<app-root>/tsconfig.app.json\",\n \"outputPath\": \"dist/<app-root>\",\n \"format\": [\"esm\", \"cjs\"]\n }\n}\n```\n\n{% /tab %}\n{% tab label=\"External packages\" %}\n\nYou can avoid packages from being bundled by providing the `external` option with a list of packages to skip.\n\nYou can also use `*` wildcard to match assets.\n\n```json\n\"build\": {\n \"executor\": \"@nx/esbuild:esbuild\",\n \"options\": {\n \"main\": \"<app-root>\",\n \"tsConfig\": \"<app-root>/tsconfig.app.json\",\n \"outputPath\": \"dist/<app-root>\",\n \"external\": [\"lodash\", \"*.png\"]\n }\n}\n```\n\n{% /tab %}\n{% tab label=\"Skip type checking\" %}\n\nType checking is the slowest part of the build. You may want to skip type checking during build and run it as another job in CI.\n\n```json\n\"build\": {\n \"executor\": \"@nx/esbuild:esbuild\",\n \"options\": {\n \"main\": \"<app-root>\",\n \"tsConfig\": \"<app-root>/tsconfig.app.json\",\n \"outputPath\": \"dist/<app-root>\",\n \"skipTypeCheck\": true\n }\n}\n```\n\n{% /tab %}\n{% tab label=\"Additional esbuild options\" %}\n\nAdditional [esbuild options](https://esbuild.github.io/api/) can be passed using `esbuildOptions` in your project configuration.\n\n```json\n\"build\": {\n \"executor\": \"@nx/esbuild:esbuild\",\n \"options\": {\n \"main\": \"<app-root>\",\n \"tsConfig\": \"<app-root>/tsconfig.app.json\",\n \"outputPath\": \"dist/<app-root>\",\n \"esbuildOptions\": {\n \"legalComments\": \"inline\"\n \"banner\": {\n \".js\": \"// banner\"\n },\n \"footer\": {\n \".js\": \"// footer\"\n }\n }\n }\n}\n```\n\n{% /tab %}\n{% tabs %}\n",
|
||||||
"presets": []
|
"presets": []
|
||||||
},
|
},
|
||||||
"description": "Bundle a package using EsBuild.",
|
"description": "Bundle a package using EsBuild.",
|
||||||
|
|||||||
@ -38,10 +38,11 @@ nx build <app-name> # defaults to es# defaults to esm
|
|||||||
"build": {
|
"build": {
|
||||||
"executor": "@nx/esbuild:esbuild",
|
"executor": "@nx/esbuild:esbuild",
|
||||||
"options": {
|
"options": {
|
||||||
"main": "<app-root>",
|
"main": "<app-root>",
|
||||||
"tsConfig": "<app-root>/tsconfig.app.json",
|
"tsConfig": "<app-root>/tsconfig.app.json",
|
||||||
"outputPath": "dist/<app-root>",
|
"outputPath": "dist/<app-root>",
|
||||||
"format": ["esm", "cjs"]
|
"format": ["esm", "cjs"]
|
||||||
|
}
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
@ -56,10 +57,11 @@ You can also use `*` wildcard to match assets.
|
|||||||
"build": {
|
"build": {
|
||||||
"executor": "@nx/esbuild:esbuild",
|
"executor": "@nx/esbuild:esbuild",
|
||||||
"options": {
|
"options": {
|
||||||
"main": "<app-root>",
|
"main": "<app-root>",
|
||||||
"tsConfig": "<app-root>/tsconfig.app.json",
|
"tsConfig": "<app-root>/tsconfig.app.json",
|
||||||
"outputPath": "dist/<app-root>",
|
"outputPath": "dist/<app-root>",
|
||||||
"external": ["lodash", "*.png"]
|
"external": ["lodash", "*.png"]
|
||||||
|
}
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
@ -72,10 +74,11 @@ Type checking is the slowest part of the build. You may want to skip type checki
|
|||||||
"build": {
|
"build": {
|
||||||
"executor": "@nx/esbuild:esbuild",
|
"executor": "@nx/esbuild:esbuild",
|
||||||
"options": {
|
"options": {
|
||||||
"main": "<app-root>",
|
"main": "<app-root>",
|
||||||
"tsConfig": "<app-root>/tsconfig.app.json",
|
"tsConfig": "<app-root>/tsconfig.app.json",
|
||||||
"outputPath": "dist/<app-root>",
|
"outputPath": "dist/<app-root>",
|
||||||
"skipTypeCheck": true
|
"skipTypeCheck": true
|
||||||
|
}
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
@ -88,16 +91,17 @@ Additional [esbuild options](https://esbuild.github.io/api/) can be passed using
|
|||||||
"build": {
|
"build": {
|
||||||
"executor": "@nx/esbuild:esbuild",
|
"executor": "@nx/esbuild:esbuild",
|
||||||
"options": {
|
"options": {
|
||||||
"main": "<app-root>",
|
"main": "<app-root>",
|
||||||
"tsConfig": "<app-root>/tsconfig.app.json",
|
"tsConfig": "<app-root>/tsconfig.app.json",
|
||||||
"outputPath": "dist/<app-root>",
|
"outputPath": "dist/<app-root>",
|
||||||
"esbuildOptions": {
|
"esbuildOptions": {
|
||||||
"legalComments": "inline"
|
"legalComments": "inline"
|
||||||
"banner": {
|
"banner": {
|
||||||
".js": "// banner"
|
".js": "// banner"
|
||||||
},
|
},
|
||||||
"footer": {
|
"footer": {
|
||||||
".js": "// footer"
|
".js": "// footer"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user