Website |
Getting started |
Documentation |
Plugins |
FAQ
Our current build tools for the web are 10-100x slower than they could be:
The main goal of the esbuild bundler project is to bring about a new era of build tool performance, and create an easy-to-use modern bundler along the way.
Major features:
- Extreme speed without needing a cache
- ES6 and CommonJS modules
- Tree shaking of ES6 modules
- An API for JavaScript and Go
- TypeScript and JSX syntax
- Source maps
- Minification
- Plugins
Check out the getting started instructions if you want to give esbuild a try.
This is a fork of the original project that demonstrates experimental features:
- Analysis of module dependencies only, without compiling the output bundle. (see the branch analyse)
- Support for AMD input (WIP). (see the branch amdjs)
- Support for UMD output. (see the branch umdjs)
If you want to use the command-line in terminal, install the esbuild
binary globally by either of:
npm i -g @prantlf/esbuild
pnpm i -g @prantlf/esbuild
yarn global add @prantlf/esbuild
If you want to use the binary from scripts
in package.json
or as a service from JavaScript, install the esbuild
binary as a development dependency of your project:
npm i -D @prantlf/esbuild
pnpm i -D @prantlf/esbuild
yarn add -D @prantlf/esbuild
How to perform the source analysis only on the command line:
esbuild --analyse entry.js --metafile=dependencies.json
in Go:
result := api.Analyse(api.AnalyseOptions{
EntryPoints: []string{"entry.js"},
Metafile: "dependencies.json",
LogLevel: api.LogLevelInfo,
})
and in JavaScript:
const result = await service.analyse({
entryPoints: ['entry.js'],
metafile: 'dependencies.json',
write: false
});
How to build an AMD project on the command line:
esbuild --bundle --amdconfig=config.json main.js --outfile=out/bundle.js
with the following config.json
:
{
"baseUrl": "src",
"paths": {
"external": "empty:",
"internal": "."
},
"map": {
"*": {
"external/libs/jquery": "internal/libs/jquery"
}
},
"plugins": {
"json": {
"fileExtensions": [".json"]
},
"css": {
"fileExtensions": [".css"],
"appendFileExtension": true
},
"i18n": {
"fileExtensions": [".js"],
"loadScript": {
"replacementPattern": "/nls/",
"replacementValue": "/nls/root/"
}
}
}
}
How to build an UMD library on the command line:
esbuild --bundle --format=umd --global-name=mylib index.js --outfile=bundle.js