Skip to content

CLI Options

Usage: bunup [...entries] [...flags]

Arguments:
  [...entries]  Entry point files to bundle

Flags:
       --entry                            <val>                            Entry file or glob pattern
       --entry                            <val,...>                        Multiple entry files or globs
   -c, --config                           <val>                            Path to a custom configuration file Example: ./configs/custom.bunup.config.js
       --config                                                            Whether to use a configuration file (default: true)
       --no-config                                                         Explicitly disable config
       --filter                           <val,...>                        Filter workspace packages by name
       --name                             <val>                            Name of the build configuration (for logging and identification) Example: my-library
   -o, --out-dir                          <val>                            Output directory for bundled files (default: "dist")
       --format                           <esm|cjs|iife>                   Single output format
       --format                           <val,...>                        Multiple output formats
       --minify                                                            Enable all minification options (whitespace, identifiers, syntax)
       --no-minify                                                         Explicitly disable minify
       --minify-whitespace                                                 Minify whitespace in the output to reduce file size
       --no-minify-whitespace                                              Explicitly disable minify whitespace
       --minify-identifiers                                                Minify identifiers by renaming variables to shorter names
       --no-minify-identifiers                                             Explicitly disable minify identifiers
       --minify-syntax                                                     Minify syntax by optimizing code structure
       --no-minify-syntax                                                  Explicitly disable minify syntax
       --watch                                                             Watch for file changes and rebuild automatically
       --no-watch                                                          Explicitly disable watch
       --clean                                                             Clean the output directory before building (default: true)
       --no-clean                                                          Explicitly disable clean
   -q, --silent                                                            Disable logging during the build process
       --no-silent                                                         Explicitly disable silent
       --splitting                                                         Enable code splitting (enabled by default for ESM format)
       --no-splitting                                                      Explicitly disable splitting
       --conditions                       <val,...>                        Package.json export conditions for import resolution
   -t, --target                           <bun|node|browser>               Target environment for the bundle (default: "node")
       --external                         <val,...>                        External packages that should not be bundled
       --no-external                      <val,...>                        Packages that should be bundled even if listed in external
       --shims                                                             Enable shims for Node.js globals and ESM/CJS interoperability
       --no-shims                                                          Explicitly disable shims
       --report.gzip                                                       Enable gzip compression size calculation (default: true)
       --no-report.gzip                                                    Explicitly disable report gzip
       --report.brotli                                                     Enable brotli compression size calculation
       --no-report.brotli                                                  Explicitly disable report brotli
       --report.max-bundle-size           <n>                              Maximum bundle size in bytes. Will warn if exceeded
       --dts.entry                        <val>                            Single entrypoint for declaration file generation
       --dts.entry                        <val,...>                        Multiple entrypoints for declaration file generation
       --dts.resolve                                                       Resolve types from dependencies
       --dts.resolve                      <val,...>                        Names or patterns of packages from which to resolve types
       --no-dts.resolve                                                    Explicitly disable dts resolve
       --dts.splitting                                                     Enable declaration file splitting
       --no-dts.splitting                                                  Explicitly disable dts splitting
       --dts.minify                                                        Minify generated declaration files
       --no-dts.minify                                                     Explicitly disable dts minify
       --dts                                                               Generate TypeScript declaration files (.d.ts)
       --no-dts                                                            Explicitly disable dts
       --preferred-tsconfig               <val>                            Path to a custom tsconfig.json file used for path resolution during both bundling and TypeScript declaration generation. Example: ./tsconfig.build.json
       --sourcemap                                                         Generate a sourcemap (uses the inline type by default)
       --sourcemap                        <none|linked|inline|external>    Generate a sourcemap with a specific type
       --no-sourcemap                                                      Explicitly disable sourcemap
       --define.<key>                     <val>                            Define global constants replaced at build time Example: --define.PACKAGE_VERSION='"1.0.0"'
       --env.<key>                        <val>                            Explicit env var mapping Example: --env.NODE_ENV="production" --env.API_URL="https://api.example.com"
       --env                              <inline|disable>                 inline: inject all, disable: inject none
       --env                              <val>                            Inject env vars with this prefix Example: MYAPP_* (Environment prefix must end with *)
       --banner                           <val>                            Banner text added to the top of bundle files
       --footer                           <val>                            Footer text added to the bottom of bundle files
       --drop                             <val,...>                        Remove function calls from bundle Example: --drop console,debugger
       --loader.<key>                     <js|jsx|ts|tsx|...>              File extension to loader mapping Example: --loader.'.css'=text --loader.'.txt'=file
       --public-path                      <val>                            Public path prefix for assets and chunk files Example: https://cdn.example.com/
       --jsx.runtime                      <automatic|classic>              JSX runtime mode
       --jsx.import-source                <val>                            Import source for JSX functions
       --jsx.factory                      <val>                            JSX factory function name
       --jsx.fragment                     <val>                            JSX fragment function name
       --jsx.side-effects                                                  Whether JSX functions have side effects
       --no-jsx.side-effects                                               Explicitly disable jsx side effects
       --jsx.development                                                   Use jsx-dev runtime for development
       --no-jsx.development                                                Explicitly disable jsx development
       --ignore-dce-annotations                                            Ignore dead code elimination annotations (@__PURE__, sideEffects)
       --no-ignore-dce-annotations                                         Explicitly disable ignore dce annotations
       --emit-dce-annotations                                              Force emit @__PURE__ annotations even with minification
       --no-emit-dce-annotations                                           Explicitly disable emit dce annotations
       --on-success                       <val>                            Command to run after successful build
       --exports.exclude                  <val,...>                        Configure automatic package.json exports generation - Entry points to exclude from exports field
       --exports.exclude-css                                               Whether to exclude CSS files from exports field
       --no-exports.exclude-css                                            Explicitly disable exports exclude css
       --exports.include-package-json                                      Whether to include "./package.json" in exports field (default: true)
       --no-exports.include-package-json                                   Explicitly disable exports include package json
       --exports.all                                                       Whether to add wildcard export for deep imports
       --no-exports.all                                                    Explicitly disable exports all
       --exports                                                           
       --no-exports                                                        Explicitly disable exports
       --unused.level                     <warn|error>                     Detect and report unused dependencies - The level of reporting for unused dependencies (default: "warn")
       --unused.ignore                    <val,...>                        Dependencies to ignore when checking for unused dependencies
       --unused                                                            
       --no-unused                                                         Explicitly disable unused
       --css.typed-modules                                                 Generate TypeScript definitions for CSS modules (default: true)
       --no-css.typed-modules                                              Explicitly disable css typed modules
       --css.inject.minify                                                 Inject CSS styles into document head at runtime - Whether to minify the styles being injected
       --no-css.inject.minify                                              Explicitly disable css inject minify
       --css.inject                                                        
       --no-css.inject                                                     Explicitly disable css inject
  -h, --help                                                               Display this menu and exit

Examples:
  bunup                            # Basic build

  bunup src/index.ts               # Single entry file

  bunup src/**/*.ts                             # Glob pattern for multiple files

  bunup --watch                    # Watch mode

  bunup --format cjs,esm           # Multiple formats

  bunup --target bun               # Bun target

  bunup src/cli.ts                 # Multiple entries

  bunup --dts.splitting            # Declaration splitting

  bunup --no-clean                 # Disable cleaning output directory before build

Released under the MIT License.