3 ms·
I was a little surprised that Vite, which depends on esbuild and thus should know better, is written in Javascript. I presume this is a considered choice, and
by zellyn 5y ago
I was a little surprised that Vite, which depends on esbuild and thus should know better, is written in Javascript.
I presume this is a considered choice, and that what Vite does is unlikely to be on the critical path for edit/build/view cycle time…
- andrew_ 5y ago> thus should know better This reads as a very acrimonious, biased take. Authors choose the tools they use based on a number of criteria and personal preferences. It's one thing to disagree with them, it's another to project judgement without knowing the why.
- afavour 5y ago> thus should know better I would posit that perhaps they know better than you. When pure performance is the concern it makes sense to go to a more performant language, like Go. But every time your JavaScript build tool moves away from JavaScript you close yourself off to a huge pool of potential code contributors and make it a lot more difficult to customise. So I think Vite has it just right: optimise the really intensive stuff, leave the rest more available and more editable.
- wonnage 5y agoThe speedup from tools like esbuild, swc, etc. are not because of the language they were written in but because they're competing against Babel. Babel is this single-threaded highly-extensible behemoth. On top of this, you're encouraged to install dozens of plugins, and each plugin has access to global state. The new transpilers have worked around this problem by introducing various limitations. esbuild plugins literally can't modify the AST. It's basically a way for you to run a command on a string/file. So sure, if you redefine the problem as string transforms rather than AST transforms, you can get an O(N) speedup...
- eliseumds 5y agoPrecisely. I'd advise having esbuild behind Babel if you really need an specific Babel plugin, for ex: * Transform the file using esbuild first * Then use Babel with that one specific plugin (Loadable Components, Styled Components, Apollo, React Refresh...) This is much faster than letting Babel do all the work.
- zellyn 5y agoHmmm. I knew I was being a bit of a smartass with, “and thus should know better”, but I figured I mediated that in the second sentence, where I presumed they know what they're doing. ¯\_(ツ)_/¯