mirror of
https://github.com/denoland/deno.git
synced 2025-09-27 20:59:10 +00:00
docs: Deno.emit supports bundling as IIFE (#10242)
Co-authored-by: Luca Casonato <lucacasonato@yahoo.com>
This commit is contained in:
parent
a1ac17f9fa
commit
0a699f416b
1 changed files with 22 additions and 20 deletions
|
@ -23,8 +23,10 @@ The emit options are defined in the `Deno` namespace as:
|
||||||
```ts
|
```ts
|
||||||
interface EmitOptions {
|
interface EmitOptions {
|
||||||
/** Indicate that the source code should be emitted to a single file
|
/** Indicate that the source code should be emitted to a single file
|
||||||
* JavaScript bundle that is an ES module (`"esm"`). */
|
* JavaScript bundle that is a single ES module (`"esm"`) or a single file
|
||||||
bundle?: "esm";
|
* self contained script we executes in an immediately invoked function
|
||||||
|
* when loaded (`"iife"`). */
|
||||||
|
bundle?: "esm" | "iife";
|
||||||
/** If `true` then the sources will be typed checked, returning any
|
/** If `true` then the sources will be typed checked, returning any
|
||||||
* diagnostic errors in the result. If `false` type checking will be
|
* diagnostic errors in the result. If `false` type checking will be
|
||||||
* skipped. Defaults to `true`.
|
* skipped. Defaults to `true`.
|
||||||
|
@ -179,9 +181,9 @@ if (diagnostics.length) {
|
||||||
### Bundling
|
### Bundling
|
||||||
|
|
||||||
`Deno.emit()` is also capable of providing output similar to `deno bundle` on
|
`Deno.emit()` is also capable of providing output similar to `deno bundle` on
|
||||||
the command line. This is enabled by setting the _bundle_ option to `"esm"`.
|
the command line. This is enabled by setting the _bundle_ option to `"esm"` or
|
||||||
(Currently Deno only supports bundling as a single file ES module, but there are
|
`"iife"`. Currently Deno supports bundling as a single file ES module (`"esm"`)
|
||||||
plans to add support for an IIFE bundle format as well):
|
or a single file self contained legacy script (`"iife"`).
|
||||||
|
|
||||||
```ts
|
```ts
|
||||||
const { files, diagnostics } = await Deno.emit("./mod.ts", {
|
const { files, diagnostics } = await Deno.emit("./mod.ts", {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue