srid / leptos-fullstack

A Nix template for full-stack web apps in Rust using Leptos
MIT License
68 stars 8 forks source link

Avoid full rebuilds #12

Open srid opened 1 year ago

srid commented 1 year ago

Changing one local source file is enough to trigger a full re-build of all crates. Isn't crane supposed to solve this by building deps separately?

Pegasust commented 1 year ago

This triggers me quite a lot too. It was one of the things that stood out when I switched from just using nixpkgs's Rust build utility to Crane. Crane actually adds build time, be it with or without the dummy source.

It might be that the project I'm having is not big enough to take advantage of the dummy, extern-crate-only cache.

pati08 commented 3 months ago

This is an issue for me as well, as I'm using this to package my app into a docker image even in development. I looked into it, and to me it seems like the artifacts are being built only for one of the configurations that cargo-leptos builds the project in. See this snippet:

            craneBuild = rec {
              args = {
                inherit src;
                pname = name;
                version = version;
                buildInputs = [
                  pkgs.cargo-leptos
                  pkgs.binaryen # Provides wasm-opt
                  tailwindcss
                  pkgs.dart-sass
                ];
              };
              cargoArtifacts = craneLib.buildDepsOnly args;
              buildArgs = args // {
                inherit cargoArtifacts;

I'm not quite sure how to solve this, but I'll certainly be thinking about it.

pati08 commented 3 months ago

Also, I'm using the multi-crate leptos mode.