Skip to content

Why Webpack

Martin Kavík edited this page Oct 1, 2019 · 1 revision

So why Webpack instead of Rust-only build pipeline?

  • Some tools are still (?) missing in Rust ecosystem — e.g. hot-reload, auto-reload with browser tab refresh, CSS/HTML minification, autoprefixer, prerendering, alternative to TailwindCSS…, etc. And yeah, I don’t have so much free time to fix or write them all.

  • There is js! macro in cargo-web, but there isn’t (?) alternative for wasm-pack for writing custom JS scripts. And you want to write JS scripts because libraries like web_sys still don’t (?) support all JS / DOM APIs. And if I have to write JS, I’d rather use Typescript — that's why seed-quickstart-webpack has preconfigured Typescript support (some examples are in branch older).

  • “Why not Python / Ruby / bash scripts?” — I’m working mainly on Windows and was working on Mac. Many Seed users use Windows, too. If I can’t write it in cross-platform Rust, I’d rather write it with Node.js, because there is a better chance that it would work.

  • "Why not other bundlers? E.g. Parcel." - I’ve tried JS alternatives, including Parcel, but they were just too slow (yeah, it was several months ago, maybe it’s better now) and there were missing tools or documentation compared to Webpack. Everybody knows Webpack (even if everybody hates to setup it).

  • Once I decide I can/want to rewrite seed-quickstart-webpack to Rust-only solution, I will know exactly what I want so Rust code will be probably clean enough.

Clone this wiki locally