ESBuild is a fast bundelr for Javascript.
YOUTUBE 9XS_RA6zyyU
Why Are People Obsessed With ESBuild? - youtube ![]()
Most other bundlers are written in JavaScript, but a command-line application is a worst-case performance situation for a JIT-compiled language. Every time you run your bundler, the JavaScript VM is seeing your bundler's code for the first time without any optimization hints. While esbuild is busy parsing your JavaScript, node is busy parsing your bundler's JavaScript. By the time node has finished parsing your bundler's code, esbuild might have already exited and your bundler hasn't even started bundling yet. In addition, Go is designed from the core for parallelism while JavaScript is not. Go has shared memory between threads while JavaScript has to serialize data between threads. Both Go and JavaScript have parallel garbage collectors, but Go's heap is shared between all threads while JavaScript has a separate heap per JavaScript thread. This seems to cut the amount of parallelism that's possible with JavaScript worker threads in half according to my testing, presumably since half of your CPU cores are busy collecting garbage for the other half.
# ESBuild
- javascript - How can I... - stackoverflow.com
- esbuild - Getting Started - github.io
- esbuild - Getting Started - github.io
# Errors
I could not get ESBuild to build a complex project for Sketchviz Docker. There were the following errors:
fortyfoxes@Black-5 sketchviz % ./node_modules/.bin/esbuild roughen.js --bundle --outfile=out.js --platform=node > node_modules/jsdom/lib/jsdom/utils.js:158:25: error: Could not resolve "canvas" (mark it as external to exclude it from the bundle, or surround it with try/catch to handle the failure at run-time) 158 │ const Canvas = require("canvas"); ╵ ~~~~~~~~ > node_modules/jsdom/lib/jsdom/living/xhr/XMLHttpRequest-impl.js:31:57: warning: "./xhr-sync-worker.js" should be marked as external for use with "require.resolve" 31 │ const syncWorkerFile = require.resolve ? require.resolve("./xhr-sync-worker.js") : null;
However ESBuild bindles the typescript version without problems - github ![]()
# See also