jetpack.js
is an extremely fast js bundler and minifier.
jetpack.js
a well designed tool. It's modulize into parser and bundler.
The parser can be used as a library independently.
- Can be used standalone
- Implemented in C++ with excellent performance
- Full support for ECMAScript 2017(ECMA-262 8th Edition)
- JSON output of sensible syntax tree format as standardized by ESTree project
- Experimental support for JSX, a syntax extension for React
- Syntax node location (index-based and line-column)
- Friendly error message
- Module resolution.
- Bundle a ES project into a single file.
- Scope hoisting.
- Constant folding.
- Minify the code.
- Sourcemap generation
Download the binary from the release page.
Usage:
jetpack-cli --help
npm install -g jetpp
Use command line to bundle a js module.
jetpp main.js --out bundle.js
Help command:
$ jetpp --help
Jetpack command line
Usage:
Jetpack [OPTION...] positional parameters
--tolerant tolerant parsing error
--jsx support jsx syntax
--library bundle as library, do not bundle node_modules
--help produce help message
--analyze-module arg analyze a module and print result
--no-trace do not trace ref file when analyze module
--minify minify the code
--out arg output filename of bundle
--sourcemap generate sourcemaps
jetpack.js is built with CMake, so it can be easily integrated to your project.
add_subdirectory(esparser)
target_include_directories(${PROJECT_NAME} ./esparser/src)
target_link_libraries(${PROJECT_NAME} PUBLIC esparser)
I do the same benchmark provided by esbuild.
My main benchmark approximates a large codebase by duplicating the three.js library 10 times and building a single bundle from scratch, without any caches. For this benchmark, esbuild is 10-100x faster than the other JavaScript bundlers I tested (Webpack, Rollup, Parcel, and FuseBox). The benchmark can be run with make bench-three.
The tests were done on a 6-core 2018 MacBook Pro with 16GB of RAM (similar to esbuild).
The code are well commented, please read the code.
jetpack.js
supports all popular system including:
- macOS x64/arm64
- Windows 64bit
- Linux 64bit
- jemalloc 5.2.1
- cxxopts
- fmt
- nlohmann_json
- robin-hood-hashing 3.11.1
- xxHash