Live data from Hacker News

Esbuild – An extremely fast JavaScript bundler

esbuild.github.io

31–40 of 288 posts

Re: Esbuild – An extremely fast JavaScript bundler

#31
post #4

Isn't the browser also an extremely fast Javscript bundler? How many scripts does a site need to make it feel faster when bundled? When I visit websites that are rendered serverside, they usually feel instant to me. Even when they load a dozen scripts or so.

What ESBuild offers over plain ESM is: - fast TypeScript/JSX compile - bundling shared code to reduce request waterfall/splitting to reduce redundancy - bundle optimization (tree shaking/dead code elimination; minification is actually faster than not using it) - a simple plugin system for use cases like other compiled frameworks like Vue or Svelte, or whatever else you might want in a build pipeline

On the downside, it will put all the code into one giant script that has to be downloaded upfront.

While a website that loads scripts per page will only load the scripts that are needed on the current page.

Re: Esbuild – An extremely fast JavaScript bundler

#32
post #4

Isn't the browser also an extremely fast Javscript bundler? How many scripts does a site need to make it feel faster when bundled? When I visit websites that are rendered serverside, they usually feel instant to me. Even when they load a dozen scripts or so.

> When I visit websites that are rendered serverside, they usually feel instant to me. Even when they load a dozen scripts or so

Then they'll be faster doing only one request, this is regardless of ssr or spa

Bundling also gives you slatic analysis (typescript and linting), and frees developers from developing in the dark, like keeping track in their brain what component in what script exposes what global.

Re: Esbuild – An extremely fast JavaScript bundler

#33
post #29

I would rather use Parcel.

what is the point of the comment? It reads: I have an opinion (and here it is, but who gives a shit if you don't elaborate)

I don't think context (JS build tool) is missing here.

If someone has open mind, they can also google what is Parcel.

Re: Esbuild – An extremely fast JavaScript bundler

#34
I had ignored this space for a while as I didn't see any need to fiddle with it. But there does seem to be quite a lot of movement now on Webpack alternatives. The speed improvements do look very interesting, though I'm not so sure how much of the delays I'm seeing with Webpack/Create React App are from the Typescript checking. I mean Typescript is awesome, but it's also not all that fast in building and type checking.

Vite seems to be one of the more interesting CRA alternatives. Though it uses esbuild only for development, and Rollup for production builds. It'll be interesting to see how this develops, and if the fast bundlers keep catching up in terms of features without getting slower.

Re: Esbuild – An extremely fast JavaScript bundler

#35

Are there any tools that transform HTML and other files? For example, lets say I have an tag with a src attribute that points to a local image. Can I automatically replace that with a tag with various formats (jpg, webp, avif) and sizes?

Rehype is an HTML processor with an ecosystem of plugins: https://github.com/rehypejs/rehype/

Re: Esbuild – An extremely fast JavaScript bundler

#36
post #12

How is it possible to be so fast?

Answered in the FAQ:

Why is esbuild fast? https://esbuild.github.io/faq/#why-is-esbuild-fast

- It's written in Go and compiles to native code

- Parallelism is used heavily

- Written from scratch with performance as a goal

- Efficient use of memory

Re: Esbuild – An extremely fast JavaScript bundler

#38
post #8

What I need is a similar speedup for my Typescript and eslint checks. Bundling isn’t my main issue.

> Bundling isn’t my main issue.

This.

Bundling, and even barreling, have pretty much been solved problems for a while. Right now I feel that unit test frameworks, linters, and type checkers are by far the main bottlenecks in the development workflow.

Re: Esbuild – An extremely fast JavaScript bundler

#39
post #37

has anyone used this in react-native ?

Pretty sure the Expo folks are working on this!

ah - apparently ESBuild cannot be used for transpilation in React Native. But can be used for minification.

https://www.npmjs.com/package/metro-minify-esbuild

Post reply on HN