Linux command
esbuild 命令
文件
复制后可按需替换文件名、目录或参数。
常用示例
Bundle JavaScript file
esbuild [app.js] --bundle --outfile=[out.js]
Bundle with minification
esbuild [app.js] --bundle --minify --outfile=[out.js]
Bundle TypeScript
esbuild [app.ts] --bundle --outfile=[out.js]
Watch mode
esbuild [app.js] --bundle --watch --outfile=[out.js]
Start dev server
esbuild [app.js] --bundle --serve=[8000]
Bundle for browser
esbuild [app.js] --bundle --platform=browser --outfile=[out.js]
Generate source maps
esbuild [app.js] --bundle --sourcemap --outfile=[out.js]
说明
esbuild is an extremely fast JavaScript and TypeScript bundler and minifier. Written in Go, it's 10-100x faster than traditional bundlers like webpack or Parcel. The tool handles bundling, minification, code splitting, tree shaking, and transpilation. It supports JSX, TypeScript, and modern JavaScript features without configuration. esbuild's speed makes it ideal for development builds and as a lower-level tool in build pipelines.
参数
- --bundle
- Bundle dependencies.
- --outfile _FILE_
- Output file path.
- --minify
- Minify output.
- --watch
- Rebuild on changes.
- --serve _PORT_
- Start development server.
- --platform _PLATFORM_
- Target: browser, node, neutral.
- --sourcemap
- Generate source maps.
- --target _VERSION_
- JavaScript target version.
- --help
- Display help information.
FAQ
What is the esbuild command used for?
esbuild is an extremely fast JavaScript and TypeScript bundler and minifier. Written in Go, it's 10-100x faster than traditional bundlers like webpack or Parcel. The tool handles bundling, minification, code splitting, tree shaking, and transpilation. It supports JSX, TypeScript, and modern JavaScript features without configuration. esbuild's speed makes it ideal for development builds and as a lower-level tool in build pipelines.
How do I run a basic esbuild example?
Run `esbuild [app.js] --bundle --outfile=[out.js]` in a terminal, then adjust file names, paths, flags, or remote targets for your system.
What does --bundle do in esbuild?
Bundle dependencies.