ESBuilder
Simple and easy to use solution for building your modules to native ES syntax.
You can found this project on Deno.land registry.
Installations
Install from Deno (Simpliest way)
Run the following command:
deno install \
--allow-read \
--allow-write \
--allow-env \
--allow-run \
--name esbuilder \
https://deno.land/x/esbuilder/builder.tsInstall by VSCode task runner (No terminal way)
- Clone this repository
- Open repo in VS Code
- Open Command Pallete (
Ctrl + Shift + P/β + Shift + P)- Select β
Tasks: Run Task - Run β
Install ESBuilder
- Select β
Install in Terminal from Repository
- Clone this repository
- Run the following command:
deno install \
--allow-read \
--allow-write \
--allow-env \
--allow-run \
--allow-net \
--no-prompt \
--name esbuilder \
./builder.tsUninstallations
Simple!
deno uninstall esbuilderUsage
esbuilder --config=./config.jsonHelp
esbuilder --helpAlternative
deno run --allow-all ./builder.ts --config=./config.json
deno run --allow-all ./builder.bundled.js --config=./config.jsonConfiguration
Example
{
"version": "1.0",
"sourceDir": "./src",
"outDir": "./dist",
"files": [
"./file1.ts",
"./file2.ts",
],
"build": {
"bundle": true,
"minify": true,
"sourcemap": true
},
"options": {
"watch": true,
"gitignore": true,
}
}Properties
Version β Required
Version of config schema/syntax. Defaults to current version of Builder.
{
"version": "1.0"
}The notation "1.0" and "1.0.0" are equivalent.
Source directory β Optional
Path to source directory.
Defaults to ./.
{
"sourceDir": "./src"
}Output directory β Optional
Path to output directory.
Defaults to ./build.
{
"outDir": "./dist"
}Files / Entry points β Optional
Paths to entry files relative to sourceDir.
{
"files": [
"./file1.ts",
"./dir/file2.ts",
]
}{
"files": {
"MyGroupA": "./file1.ts",
"MyGroupB": [
"./file1.ts",
"./dir/file2.ts"
]
}
}Build Settings β Optional
Bundle β Optional
Whether to bundle entry file (with dependecies) into a single file.
Defaults to false.
{
"build": {
"bundle": true
}
}Minify β Optional
Whether to minify the output.
Defaults to false.
{
"build": {
"minify": true
}
}Source Maps β Optional
Whether to create source map files.
Defaults to false.
{
"build": {
"sourcemap": true
}
}Options β Optional
Verbose β Optional
Whether to print verbose output.
Defaults to true.
{
"options": {
"verbose": false
}
}Watch β Optional
If true, watch for changes in source files and rebuild.
Defaults to false.
You can forced by passing --watch flag.
{
"options": {
"watch": true
}
}tsconfig β Optional
Path to tsconfig.json.
Defaults to null.
{
"options": {
"tsconfig": "./tsconfig.json"
}
}Generate .gitignore β Optional
Whether to create .gitignore with built outputs.
Defaults to false.
{
"options": {
"gitignore": true
}
}Generate Output summary β Optional
Whether to create json file with description of all built outputs.
Defaults to false.
{
"options": {
"outputSummary": true
}
}Example I of output summary:
{
"version": "1.0",
"files": [
"./file1.js",
"./file1.js.map",
"./dir/file2.js",
"./dir/file2.js.map"
]
}Example II of output summary:
{
"version": "1.0",
"files": {
"MyGroupA": [
"./file1.js",
"./file1.js.map"
],
"MyGroupB": [
"./file1.js",
"./file1.js.map",
"./dir/file2.js",
"./dir/file2.js.map"
]
}
}Output Summary Filename β Optional
Name of the output summary file.
Defaults to output-summary.json.
{
"options": {
"outputSummaryFilename": "output-summary.json"
}
}