by no_wizard · 5y ago · 0 comments
Interestingly I think that’s the major win of SWC over esbuild: you get a Babel like plug-in ecosystem for AST transformations and such. Downside: there currently isn’t a way to run asynchronous transforms, much like you can’t with Babel (easily anyway without some subprocess hacks)
I love Vue, but it’s forever married to the Babel parser unless Evan moves over to using SWC for compiling SFCs, which would be awesome but he has signaled multiple times he doesn’t see the Vue Compiler ever being rust based, so it would be reliant on the Vue core team (though I think this is mainly his work) porting the SFC compiler to using SWC underneath.
JSX frameworks won’t have this limitation and can get this massive speed gains and energy without such work. I could see Stencil and SolidJS adapting easily here
Maybe JSX tools just needs some re thinking to get the same SFC experience
This is trivial to do with esbuild, for what it's worth.
You can add it, via plugins, but its a serious limitation for a project like Next.js which require's these types of transforms
You also end up with diminishing returns with the more plugins in you add to esbuild, and I imagine its worse with js plugins than it is with go based ones, none the less, you have zero access to it directly
Our build times remain at 0.5s with pretty extensive source transformers in JavaScript plugins in esbuild. This is down from 5-8 minutes using rollup.
SFC, single file components.
SWF is a very clever and optimised format - it’s amazing what they fit into the minuscule Flash runtime of yesteryear when it was only around 300KB in size IIRC. It’s a shame there *still* isn’t an approachable replacement tool for non-experts for making cartoon-style animations and groundbreaking interactive games in HTML+JS yet (e.g. Fault-Line: http://www.nitrome.com/games/faultline/ )
Just Babel, SWC, ESBuild, and TypeScript's own compiler.
I'm not really aware of anything else with serious momentum, or isn't simply built upon one of these projects,
SWC itself if I recall correctly was built to address speed problems with Babel
The other speed bottleneck I've found is postcss, which SWC is also trying to address with their own new CSS parser, which is the CSS parser they extended in Next.js 12, from what I can tell
ESBuild has also grown out of this, but takes a more opinionated direction
This isn't the gulp / grunt -> browserify -> webpack / rollup churn of the past in my opinion. These kinds of tools are much more targeting on being around in the long haul
https://twitter.com/jarredsumner/status/1390084458724741121
> Early benchmark from a new JavaScript bundler. It transpiles JSX files: > - 3x faster than esbuild > - 94x faster than swc > - 197x faster than babel
That's not true... I use Vue's SFC without Babel using vite.
That's the dependency I am speaking to here
[0]: https://github.com/vuejs/vue-next/blob/master/packages/compi...