Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions runtime/fundamentals/configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -738,6 +738,28 @@ this requires an explicit opt-in with `-P` and is not loaded by default.

If you're ok with this risk, then this feature will be useful for you.

## Compile config

The `"compile"` block configures
[`deno compile`](/runtime/reference/cli/compile/) without requiring you to
repeat flags on every invocation. Starting in Deno 2.8 you can declare which
extra files or directories to bundle into the executable, and which paths to
exclude:

```jsonc title="deno.json"
{
"compile": {
"include": ["names.csv", "data", "worker.ts"],
"exclude": ["data/secrets", "**/*.test.ts"]
}
}
```

`--include` and `--exclude` flags on the command line are merged with these
lists rather than replacing them. The `"compile"` block can also carry
`permissions` (see
[Test, bench, and compile permissions](#test-bench-and-compile-permissions)).

## An example `deno.json` file

```json
Expand Down
18 changes: 18 additions & 0 deletions runtime/reference/cli/compile.md
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,24 @@ const dataFiles = Deno.readDirSync(import.meta.dirname + "/data");
Note this currently only works for files on the file system and not remote
files.

### Configuring `include` / `exclude` in `deno.json`

Starting in Deno 2.8, the `--include` and `--exclude` paths can be set
declaratively in `deno.json` so you don't have to repeat them on every
`deno compile` invocation:

```jsonc title="deno.json"
{
"compile": {
"include": ["names.csv", "data", "worker.ts"],
"exclude": ["data/secrets", "**/*.test.ts"]
}
}
```

CLI flags are merged with the config — `--include` and `--exclude` add to the
lists in `deno.json` rather than replacing them.

## Workers

Similarly to non-statically analyzable dynamic imports, code for
Expand Down