add note about --cfg=erase_components

This commit is contained in:
Greg Johnston
2025-04-02 20:52:14 -04:00
committed by GitHub
parent d42ec851f1
commit 05f7613d86

View File

@@ -139,3 +139,21 @@ If you just want to use the default options from the command line, just run `lep
If you wish to set up your editor to work with `leptosfmt`, or if you wish to customize your `leptosfmt` experience, please see the instructions available on the [`leptosfmt` github repo's README.md page](https://github.com/bram209/leptosfmt).
Just note that it's recommended to set up your editor with `leptosfmt` on a per-workspace basis for best results.
## 4) Use `--cfg=erase_components` during development
Leptos 0.7 made a number of changes to the renderer that relied more heavily on the type system. For larger projects, this can lead to slower compile times. Most of the slowdown in compile times can be alleviated by using the custom configuration flag `--cfg=erase_components` during development. You can set this easily in the command line (`RUSTFLAGS="--cfg erase_components" trunk serve` or `RUSTFLAGS="--cfg erase_components" cargo leptos watch`), or in your `.cargo/config.toml`:
```toml
# use your own native target
[target.aarch64-apple-darwin]
rustflags = [
"--cfg",
"erase_components",
]
[target.wasm32-unknown-unknown]
rustflags = [
"--cfg",
"erase_components",
]
```