diff options
author | 2023-04-29 00:08:48 -0400 | |
---|---|---|
committer | 2023-04-28 21:08:48 -0700 | |
commit | 96e113f41c0dae1ccd58c6d1e3b6dd2c54769636 (patch) | |
tree | 1f8c0b88d2daa925abff610f4a458d744bc0bf36 /docs/cli | |
parent | bc0c0f7d203567a5538f271a3bc37c450eeaee46 (diff) | |
download | bun-96e113f41c0dae1ccd58c6d1e3b6dd2c54769636.tar.gz bun-96e113f41c0dae1ccd58c6d1e3b6dd2c54769636.tar.zst bun-96e113f41c0dae1ccd58c6d1e3b6dd2c54769636.zip |
bundler tests: rest of default.test.ts and starting jsx tests (#2765)
Diffstat (limited to 'docs/cli')
-rw-r--r-- | docs/cli/build.md | 40 |
1 files changed, 20 insertions, 20 deletions
diff --git a/docs/cli/build.md b/docs/cli/build.md index b4c7984dc..3ce34df1d 100644 --- a/docs/cli/build.md +++ b/docs/cli/build.md @@ -184,7 +184,7 @@ If the bundler encounters an import with an unrecognized extension, it treats th {% codetabs %} -```ts#Build_file +```ts#Build file await Bun.build({ entrypoints: ['./index.ts'], outdir: './out' @@ -315,7 +315,7 @@ Depending on the target, Bun will apply different module resolution rules and op - `bun` - For generating bundles that are intended to be run by the Bun runtime. In many cases, it isn't necessary to bundle server-side code; you can directly execute the source code without modification. However, bundling your server code can reduce startup times and improve running performance. - All bundles generated with `target: "bun"` are marked with a special `// @bun` pragma, which indicates to the Bun runtime that there's no need to re-transpile the file before execution. This + All bundles generated with `target: "bun"` are marked with a special `// @bun` pragma, which indicates to the Bun runtime that there's no need to re-transpile the file before execution. --- @@ -493,7 +493,6 @@ const result = await Bun.build({ console.log(result.manifest); ``` -The manifest takes the following form: {% details summary="Manifest structure" %} The manifest has the following form: @@ -571,7 +570,7 @@ $ bun build ./index.tsx --outdir ./out --sourcemap=inline --- - `"inline"` -- A sourcemap is generated and appended to the end of the generated bundle as a base64 payload inside a `//# sourceMappingURL= ` comment. +- A sourcemap is generated and appended to the end of the generated bundle as a base64 payload inside a `//# sourceMappingURL=` comment. --- @@ -705,12 +704,12 @@ Customizes the generated file names. Defaults to `./[dir]/[name].[ext]`. await Bun.build({ entrypoints: ['./index.tsx'], outdir: './out', - naming: "./[dir]/[name].[ext]", // default + naming: "[dir]/[name].[ext]", // default }) ``` ```bash#CLI -n/a +$ bun build ./index.tsx --outdir ./out --entry-naming [dir]/[name].[ext] ``` {% /codetabs %} @@ -785,7 +784,7 @@ await Bun.build({ ``` ```bash#CLI -$ bun build ./index.tsx --outdir ./out --naming [name]-[hash].[ext] +$ bun build ./index.tsx --outdir ./out --entry-naming [name]-[hash].[ext] ``` {% /codetabs %} @@ -809,15 +808,16 @@ await Bun.build({ entrypoints: ['./index.tsx'], outdir: './out', naming: { - entrypoint: '[dir]/[name]-[hash].[ext]', - chunk: '[dir]/[name]-[hash].[ext]', - asset: '[dir]/[name]-[hash].[ext]', + // default values + entry: '[dir]/[name].[ext]', + chunk: '[name]-[hash].[ext]', + asset: '[name]-[hash].[ext]', }, }) ``` ```bash#CLI -n/a +$ bun build ./index.tsx --outdir ./out --entry-naming "[dir]/[name].[ext]" --chunk-naming "[name]-[hash].[ext]" --asset-naming "[name]-[hash].[ext]" ``` {% /codetabs %} @@ -973,19 +973,19 @@ The output file would now look something like this. ```ts await Bun.build({ entrypoints: string[]; // list of file path - outdir?: string; // output directory + outdir?: string; // default to in-memory build target?: "browser" | "bun" | "node"; // default: "browser" - splitting?: boolean, // default true, enable code splitting + splitting?: boolean; // default true plugins?: BunPlugin[]; - manifest?: boolean; // whether to return manifest - external?: Array<string>; + manifest?: boolean; // default false + external?: string[]; naming?: string | { - entrypoint?: string; - chunk?: string; - asset?: string; - }, // default './[dir]/[name].[ext]' + entry?: string; // default '[dir]/[name].[ext]' + chunk?: string; // default '[name]-[hash].[ext]' + asset?: string; // default '[name]-[hash].[ext]' + }; publicPath?: string; // e.g. http://mydomain.com/ - minify?: boolean | { + minify?: boolean | { // default false identifiers?: boolean; whitespace?: boolean; syntax?: boolean; |