bun <file> <args>

A fast bundler, transpiler, JavaScript Runtime and package manager for web software

Arguments

NameDescription
file
args

Subcommands

NameDescription
devStart a bun Dev server
bunBundle dependencies of input files into a '.bun' file
c, createStart a new project from a template
runRun a package.json script or executable
i, installInstall dependencies for a package.json
a, addAdd a dependency to package.json
rm, removeRemove a dependency from package.json
upgradeGet the latest version of bun
completionsInstall shell completions
discordOpen bun's Discord server
helpPrint the help menu

Options

NameDescription
--use <framework>Choose a framework, e.g. "--use next". It checks first for a package named "bun-framework-packagename" and then "packagename"
--bunfile <path>Use a .bun file (default: node_modules.bun)
--server-bunfile <path>Use a .server.bun file (default: node_modules.server.bun)
--cwd <path>Absolute path to resolve files & entry points from. This just changes the process' cwd
-c, --config [path]Config file to load bun from (e.g. -c bunfig.toml
--disable-react-fast-refreshDisable React Fast Refresh
--disable-hmrDisable Hot Module Reloading (disables fast refresh too)
--extension-order <order...>Defaults to: .tsx,.ts,.jsx,.js,.json
--jsx-factory <name>Changes the function called when compiling JSX elements using the classic JSX runtime
--jsx-fragment <name>Changes the function called when compiling JSX fragments
--jsx-import-source <module>Declares the module specifier to be used for importing the jsx and jsxs factory functions. Default: "react"
--jsx-productionUse jsx instead of jsxDEV (default) for the automatic runtime
--jsx-runtime <name>"automatic" (default) or "classic"
--main-fields <fields...>Main fields to lookup in package.json. Defaults to --platform dependent
--no-summaryDon't print a summary (when generating .bun)
-v, --versionPrint version and exit
--platform <name>"browser" or "node". Defaults to "browser"
--public-dir <path>Top-level directory for .html files, fonts or anything external. Defaults to "<cwd>/public", to match create-react-app and Next.js
--tsconfig-override <path>Load tsconfig from path instead of cwd/tsconfig.json
-d, --define <k:v...>Substitute K:V while parsing, e.g. --define process.env.NODE_ENV:"development". Values are parsed as JSON
-e, --external <module...>Exclude module from transpilation (can use * wildcards). ex: -e react
-h, --helpDisplay this help and exit
-i, --inject <module...>Inject module at the top of every file
-l, --loader <loader...>Parse files with .ext:loader, e.g. --loader .js:jsx. Valid loaders: jsx, js, json, tsx, ts, css
-u, --origin <url>Rewrite import URLs to start with --origin. Default: ""
-p, --port <port>Port to serve bun's dev server on. Default: "3000"
--silentDon't repeat the command for bun run