Skip to main content

Bundler

Bundle TypeScript and JavaScript code, along with their dependencies, into a single file. Useful for producing self-contained scripts for distribution or deployment.

Eg Deno.bundle

Functions

f
N
Deno.bundle

Bundle Typescript/Javascript code into a single file.

    Type Aliases

    T
    Deno.bundle.Format

    The output format of the bundle.

      T
      Deno.bundle.PackageHandling

      How to handle packages.

        T
        Deno.bundle.Platform

        The target platform of the bundle.

          T
          Deno.bundle.SourceMapType

          The source map type of the bundle.


            function Deno.bundle

            unstable
            #bundle(options: Deno.bundle.Options): Promise<Deno.bundle.Result>

            Bundle Typescript/Javascript code into a single file.

            This is an unstable API and requires the --unstable-bundle flag to be passed when running Deno:

            deno run --unstable-bundle main.ts
            
            const result = await Deno.bundle({
              entrypoints: ["./main.ts"],
              minify: true,
            });
            
            for (const file of result.outputFiles ?? []) {
              console.log(file.text());
            }
            

            Parameters #

            Return Type #

            namespace Deno.bundle

            unstable

            Interfaces #

            Type Aliases #

            T
            Deno.bundle.Format

            The output format of the bundle.

              T
              Deno.bundle.PackageHandling

              How to handle packages.

                T
                Deno.bundle.Platform

                The target platform of the bundle.

                  T
                  Deno.bundle.SourceMapType

                  The source map type of the bundle.





                    interface Deno.bundle.Options

                    unstable

                    Options for the bundle.

                    Properties #

                    #entrypoints: string[]

                    The entrypoints of the bundle.

                    #outputPath: string
                    optional

                    Output file path.

                    #outputDir: string
                    optional

                    Output directory path.

                    #external: string[]
                    optional

                    External modules to exclude from bundling.

                    #format: Format
                    optional

                    Bundle format.

                    #minify: boolean
                    optional

                    Whether to minify the output.

                    #keepNames: boolean
                    optional

                    Whether to keep function and class names.

                    #codeSplitting: boolean
                    optional

                    Whether to enable code splitting.

                    #inlineImports: boolean
                    optional

                    Whether to inline imports.

                    How to handle packages.

                    Source map configuration.

                    Target platform.

                    #write: boolean
                    optional

                    Whether to write the output to the filesystem.




                    type alias Deno.bundle.Format

                    unstable

                    The output format of the bundle.

                    Definition #

                    "esm"
                    | "cjs"
                    | "iife"

                    type alias Deno.bundle.PackageHandling

                    unstable

                    How to handle packages.

                    • bundle: packages are inlined into the bundle.
                    • external: packages are excluded from the bundle, and treated as external dependencies.

                    Definition #

                    "bundle" | "external"

                    type alias Deno.bundle.Platform

                    unstable

                    The target platform of the bundle.

                    Definition #

                    "browser" | "deno"


                    Did you find what you needed?

                    Privacy policy