by taitems on 10/14/21, 5:07 AM with 281 comments
by maga on 10/14/21, 10:25 AM
1. It's not just a faster replacement for a single %tool_name% in your build chain: for the vast majority of cases, it's the whole "chain" in a single cli command if you're doing it right.
That is, you don't just stick it inside, say, webpack as a faster replacement for babel (although you can). No, you look carefully through your webpack configs and its myriad of plugins, ask yourself whether you really need to inline css in jsx in png while simultaneously optimizing it for IE 4.0, realize you don't, through out the whole thing, and use esbuild instead.
I have two 50K+ LOC projects using esbuild, and I would use it even if it was slower than webpack/babel/tsc simply not to worry about the build chain breaking due to an update to some obscure dependency or plugin.
2. It is fast because it's written from scratch to do a set of particular things and do it fast, not just because it's Go and parallelized.
If you look at the commit log you will notice a lot of performance tweaks. If you look into the issues, you will find a lot of requests for additional features rejected, often due to possible negative performance impact.
3. The most impressive part about esbuild development is not just that it's one guy writing it: it is the level of support and documentation he manages to provide alongside.
The release notes alone are a good course into nitty-gritty details of the web ecosystem: all the addressed edge cases are explained in detail. To top it all off--all opened issues, no matter how uninformed they seem, find a courteous response.
by CodeIsTheEnd on 10/14/21, 7:17 AM
by ksec on 10/14/21, 11:33 AM
Probably worth a submission on its own but I am just waiting till it is fully open source.
Edit: ( Deleted those Stats, since it may not be a fair comparison and it was probably not meant to be a fair benchmark in the first place. The details are still in the linked tweets. I do not know the author or am I in anyway affiliate with Bun. )
I am also wondering how much of those optimisation could be used on ESbuild. Since Rails 7 and Phoenix 1.6 will be using esbuild and not Webpack.
[1] https://twitter.com/jarredsumner/status/1390084458724741121
by imjared on 10/14/21, 1:42 PM
After my first experiment with it, I rewrote our hundreds of lines Cloud Functions deploy script in about 15 lines (most of which is configuration options on the `build()` method).
I'm curious to explore the tool more. Kudos and thanks to the author for an unbelievably useful contribution.
by louissm_it on 10/14/21, 5:52 AM
rails new your_app -j esbuild
The only sort of issue I’ve had with it so far is you can’t use it with Inertiajs[1] as it does not support dynamic imports out of the box. Although I’m hesitant to call it an issue if its not in the scope of the project. Perhaps there are plugins I can use.
[1] - https://inertiajs.com
by qwertox on 10/14/21, 9:35 AM
- It's written in Go and compiles to native code. [...] 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. [...] Go is designed from the core for parallelism while JavaScript is not.
- Parallelism is used heavily.
by dom111 on 10/14/21, 8:19 AM
The main draw for me is the simplicity of the config too. Webpack config (even using things like Symfony's Encore) is pretty convoluted and confusing to track. This, at least in my experience, has greater readability and is simpler to understand.
by kureikain on 10/14/21, 6:00 AM
1. dev server: you have to write a bit of code for this server to act as webpack dev server 2. scss: need to install plugin, and plugin cannot use from command line then you need to write a bit of JavaScript 3. global function: if you do `process.env` now you need to inject into build script 4. node package: if the package use node stuff you have to define thing like `fs/stream` into package.json
very quickly it get into your way of doing thing.
However, once you get past that base line, the cost is constant, the complexity just stop right there and not adding up.
Plus, the speed is amazing.
by satvikpendem on 10/14/21, 7:48 AM
Rome is also being rewritten in Rust, it's more of a complete set of packages that subsume Webpack, Babel and all the other parts of the JS / TS development experience.
by phillu on 10/14/21, 6:25 AM
by petethepig on 10/14/21, 7:23 AM
I wish more products had landing pages that looked like that.
by swhitf on 10/14/21, 10:31 AM
I just switched to esbuild on our main project and the build time went from 7 minutes on CI to 1 second. Kinda stupid really. Anyway, here's to the future, let's hope it works out this time!
by Aeolun on 10/14/21, 6:04 AM
by Zarkaos on 10/14/21, 8:20 AM
The watch rebuild time went from 3-5s (actually a lot when you save your code very often) to something like .5-1 s
The full build time went from 120s to less than 5s
by moron4hire on 10/14/21, 3:03 PM
With ESBuild, everything, all the things, build in 0.25 seconds. Build script has massively reduced complexity, as there's no point in running any command other than "build all". There's just the TS code and the output. I'm still running TypeScript in watch mode separately to get compilation errors on the fly (ESBuild doesn't run the TS compiler itself, it has a custom-built translator that optimistically throws away type information), but I no longer configure it to emit translated code. And did I mention the build script is massively simpler?
by junon on 10/14/21, 8:23 AM
by sorenjan on 10/14/21, 6:13 AM
by Tade0 on 10/14/21, 10:00 AM
https://github.com/evanw/esbuild/issues/42#issuecomment-9339...
So I'm currently stuck with a build that takes minutes, even though in principle it should require only seconds.
by dugmartin on 10/14/21, 9:38 AM
It is crazy fast. It feels like the Turbo Pascal 3 of web development.
by fabian2k on 10/14/21, 6:45 AM
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.
by crubier on 10/14/21, 1:21 PM
by towndrunk on 10/14/21, 1:08 PM
by kohlerm on 10/14/21, 5:53 AM
by jerrygoyal on 10/14/21, 8:40 AM
by talkingtab on 10/14/21, 12:25 PM
by keb_ on 10/15/21, 6:25 PM
by TekMol on 10/14/21, 5:55 AM
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.
by mjackson on 10/14/21, 7:31 AM
by strzibny on 10/14/21, 10:46 AM
I already replaced Webpack in my Phoenix project (you can compare default steps for building a release here https://nts.strzibny.name/12factor-elixir-phoenix-releases/) and cannot wait to do the same in Rails.
by eezing on 10/14/21, 7:20 AM
by armchairhacker on 10/14/21, 5:09 PM
by qeternity on 10/14/21, 8:44 AM
by conaclos on 10/14/21, 10:32 AM
However, I am still have to use TSC to generate declaration files(dts). Are anyone aware of esbuold-like tool to do that job?
by XCSme on 10/14/21, 3:50 PM
Do I recommend Parcel? Not sure, it feels like every time I update the package something breaks (in their defense, it is still in Beta).
by ianberdin on 10/14/21, 8:10 PM
by sesm on 10/14/21, 2:08 PM
It actually implies that JS GC can be faster because it doesn’t require global locks and can collect garbage in parallel.
by pier25 on 10/14/21, 1:38 PM
I do have some complicated Webpack setups that I don't think can be solved with any other bundler.
by darepublic on 10/14/21, 1:10 PM
by Kiro on 10/14/21, 6:11 AM
by calmyournerves on 10/14/21, 8:19 AM
by peanut_worm on 10/14/21, 7:18 PM
by escot on 10/14/21, 2:39 PM
by k__ on 10/14/21, 4:43 PM
A bit like Parcel, but faster.
by jFriedensreich on 10/14/21, 2:03 PM
by joshxyz on 10/14/21, 7:59 AM
by sandGorgon on 10/14/21, 6:27 AM
by lovely_koala on 10/14/21, 10:59 AM
by ep103 on 10/14/21, 11:00 AM
by sAbakumoff on 10/14/21, 9:49 AM
by hit8run on 10/14/21, 6:19 AM
by Salu3 on 10/14/21, 3:18 PM
by terpimost on 10/14/21, 1:14 PM
by truth_seeker on 10/14/21, 6:08 AM
by KingOfCoders on 10/14/21, 10:56 AM
Here everyone: JS build tool in Go? Great!
+1 for parallelism of esbuild. I have a12 core machine and many tools either use one core or when forced to not benefit from more cores.
I also wish they would waste more memory, I have 32gb which re mostly unused even by large projects.
I stand by my opinion: dev tools should make it pleasant for developers not the tool writers.
by throw_m239339 on 10/14/21, 8:13 AM
I'm sorry, but the node.js community needs to stop producing these stuff... it doesn't do anything better than all the webpack vs gulp vs parcel vs snowpack vs rollup vs how many bundlers again?