Live data from Hacker News

Vite – Next Generation Front End Tooling

main.vitejs.dev

341–350 of 383 posts

Re: Vite – Next Generation Front End Tooling

#341

Earlier quoted context omitted.

> to read about what Vite is and what it does. This is actually my main complaint. I read everything on the landing page and Getting Started page and still have literally zero idea what Vite does.

Secondary call-to-action is literally "Learn more" [0] and explains in details all the problems it solves [0] https://vitejs.dev/guide/why

[deleted]

Re: Vite – Next Generation Front End Tooling

#342

I'm a sceptic to the claims; most build speedups I've seen come from the bypass of Typescript type checking/compiler errors. Since there is no other competetive compiler to Typescript than the official (and slow) tsc, I think vite works this way too? Getting hot reload and fast page refreshes is nice, but the idea is that if I get a compiler error, I ought to fix it first before I move to the browser to test my code.

There's a plugin for it: https://www.npmjs.com/package/vite-plugin-checker It shows errors in both the terminal and browser, it works great.

Re: Vite – Next Generation Front End Tooling

#343
post #60

I can’t find a vite solution for NodeJS which is disappointing. If anyone has figured out a way to ship the minimal amount of code from a NodeJS monorepo (ideally with web and server code, but generally decoupled) I’d enjoy seeing the solution!

There is vite-node: https://www.npmjs.com/package/vite-node

Here's a monorepo example, it's using cloudflare workers instead of node. But you could set up a vite-node server using concurrently or create a vite plugin.

https://github.com/gkiely/vite-app-starter

Re: Vite – Next Generation Front End Tooling

#345

Many claims here of Vite being fast. Does anyone have insight into why? Parcel apparently rewrote in Rust, but I guess that's not necessarily the bottleneck here?

Compilation/transpilation is only part of the work traditionally being done by build tools like webpack and parcel (well, webpack offloads the work to babel or similar). I believe that a lot of the speed or perceived responsiveness with Vite comes simply from not bundling the code during development.

For a long time front end tooling has been bundling your dependencies and code into one or more bundles each time you save your code and then that gets shipped to your browser. Vite on the other hand just transpile the changed module(s) and then ship that over to the browser. This works great because browser support ES modules and module resolution natively now.

Re: Vite – Next Generation Front End Tooling

#347

I'm a happy vite user, but it troubles me when I think about how complicated everything it abstracts has become. It uses rollup for some things, esbuild for others, workbox for my service worker... I switched from webpack to it, and while my config is certainly less complex, I at least could tell you what webpack is doing. Vite is magic. Can I just use esbuild yet?

Yes you can. Code splitting will potentially not land in near future, but of already there if you output esm - which you can then (if wanted) convert with a simpler tooling (e.g. Babel or swc) to another format of you want. We switched to es build a year ago and never looked back.

Re: Vite – Next Generation Front End Tooling

#348
post #135

Earlier quoted context omitted.

I have been using parcel for web development because I thought webpack is very difficult to use. However, for my latest personal project, I tried webpack. To my surprise, I found webpack 5 much simpler to use then I thought it is (significantly easier than make or gradle, the complexity is not even on the same level). Everything pretty much worked out of box now. All I had to do was to copy the starting template for…

Vite is incredibly fast compared to Webpack. I didn't really know how much time I could have been saving, and I never even thought of Webpack as slow.

IIRC Vite wraps esbuild, which is written in Go and very fast.

Re: Vite – Next Generation Front End Tooling

#349
post #61

Earlier quoted context omitted.

Interesting you've made the change. Does that mean that Vite source maps for TS/JS and CSS are now up to scratch?

Were they not before?

No. CSS source maps are a recent addition to Vue, and JS source maps have had multiple problems in dev and prod. Check the GitHub issues for full details.

Re: Vite – Next Generation Front End Tooling

#350

I'm a sceptic to the claims; most build speedups I've seen come from the bypass of Typescript type checking/compiler errors. Since there is no other competetive compiler to Typescript than the official (and slow) tsc, I think vite works this way too? Getting hot reload and fast page refreshes is nice, but the idea is that if I get a compiler error, I ought to fix it first before I move to the browser to test my code.

Actually most webpack config guides also recommend you to start Typescript checker in separate thread(there is plugin for that) and don't block compilation(transpile mode). But even you do this, the speed of webpack still isn't comparable to vite. Because vite don't really scan and bundle the whole node_modules before send browser anything. It leverage the native es module and on demand loading to allow it to 'compil…

I still don't get it. If I assume that Typescript compiler is the slowest component in the build pipeline, and run it in a separate thread, that still means I have to wait for the tsc to complete. There is little to no benefit in all the other stuff being finished faster; that will be optimizing the 5%, while my main time is wasted in the 95% of the tsc compiler process. At least to my experience, for sufficiently large projects, tsc becomes super slow.
Post reply on HN