Live data from Hacker News

Mako – fast, production-grade web bundler based on Rust

makojs.dev

151–160 of 215 posts

Re: Mako – fast, production-grade web bundler based on Rust

#151

This supports all kinds of non-platform-standard features that may tie your project to this specific bundler, but will tie them to bundlers in general. It would be much better to have projects that work without bundlers, that can use them as an optimization step.

Imagine if you could just scp your source code tree onto a CDN and it would automatically bundle it based on how clients import it.

This sounds similar to https://esm.sh/

Re: Mako – fast, production-grade web bundler based on Rust

#152
post #144

Can I kick it off programmatically inside a Cargo build via build.rs? I tried to go down this road with SWC and ... failed. To be clear: I have JS/HTML artifacts in my repo alongside Rust source. I want to bundle them then ship them inside a produced Rust binary, or at least with it. With one build step using Cargo.

what about this https://crates.io/crates/rust-embed

Well yes I'm using something familiar, to embed the HTML and JS directly. But want to embed a webpacked entity, and have it run through a typescript compiler. But would like something driven from build.rs

Re: Mako – fast, production-grade web bundler based on Rust

#154

Can I kick it off programmatically inside a Cargo build via build.rs? I tried to go down this road with SWC and ... failed. To be clear: I have JS/HTML artifacts in my repo alongside Rust source. I want to bundle them then ship them inside a produced Rust binary, or at least with it. With one build step using Cargo.

I was looking if it provided a Rust crate as a lib, similar to how esbuild is just a Go lib (if you want to use it like that) but no luck.

Re: Mako – fast, production-grade web bundler based on Rust

#155

This supports all kinds of non-platform-standard features that may tie your project to this specific bundler, but will tie them to bundlers in general. It would be much better to have projects that work without bundlers, that can use them as an optimization step.

As soon as the browser specs catch up to what the bundlers are doing I’d drop them in a heartbeat. Not holding my breath though

The browser specs largely have.

CSS has advanced enough that I haven't used Less or Sass in many years. Modules make loading easy. Import maps let you use bare module specifiers (or you could use a simple transform in a dev server). CSS modules let you import CSS into JavaScript.

I never use a bundler during development.

Re: Mako – fast, production-grade web bundler based on Rust

#156

Earlier quoted context omitted.

As soon as the browser specs catch up to what the bundlers are doing I’d drop them in a heartbeat. Not holding my breath though

You can get pretty far by using importmaps, you would not have treeshaking or a single bundled file, but it works pretty well. JSDoc can be used to add types to your project (that can be typechecked using typescript). I'm currently building a hobby project using preact, htm and jspm for packages. It's pretty nice to just start building without starting a build tool, having to wait for it to finish, make sure it's not…

You do have tree shaking: the browser only loads the modules that are imported. Only import what you use (and don't use barrel files) and you're golden.

Re: Mako – fast, production-grade web bundler based on Rust

#157

Earlier quoted context omitted.

Imagine if you could just scp your source code tree onto a CDN and it would automatically bundle it based on how clients import it.

This sounds similar to https://esm.sh/

Unfortunately singleton peer dependencies (like react) are quite complicated with esm.sh. When esm.sh rewrites a module to import react from the cdn, it kinda "decides" which version of react is it at the moment the module is built on the CDN for the first time. That's why react is "special" and gets a stable build in esm.sh (essentially pointing to a fixed version no matter which version you specify): to avoid the dreaded "two copies of react" error.

Re: Mako – fast, production-grade web bundler based on Rust

#158
post #46

Earlier quoted context omitted.

If they didn’t tell us it was built in Rust how would we ever know how smart the developers are?

Yeah, that's how I ended up using prisma... until I realised they didn't have joins All this aside, knowing something is in Rust tells me: - It's fast - It's maintainable (imagine the same project but in C)

prisma not having SQL JOINS for a ling time is how I know I should just ship it when it comes to my projects.

Re: Mako – fast, production-grade web bundler based on Rust

#159

I don't work in web, and possibly live under a rock. I'm a little confused around what bundlers actually do? I'd sort of assumed it was a typescript build thing before, but Mako's page gives me enough info to make me realise I'm wrong, but seems to assume people are working with some base knowledge I don't have. Any pointers to information of exactly what bundlers do? The emphasis on speed makes it sound like it's do…

Yes, here's a few excellent articles that explain what problems build tools solve and why they exist:

- https://sunsetglow.net/posts/frontend-build-systems.html

- https://www.innoq.com/en/articles/2021/12/what-does-a-bundle...

- https://www.swyx.io/jobs-of-js-build-tools

Loosely put, they're the equivalent of all of `gcc` or `rustc`: compile the source code, run type checking, output object files, transform into the final combined executable output format.

Re: Mako – fast, production-grade web bundler based on Rust

#160
I'm not a web developer, though I still develop web apps regularly.

What exactly is the point of a bundler in the rapid development cycle? If you want your web app to load up fast, it's better if you only need to redownload the parts that actually changed, so you're better off not bundling them.

Post reply on HN