Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix incremental compilation by using separate target dir for front #203

Merged
merged 2 commits into from
Oct 13, 2023

Conversation

crapStone
Copy link
Contributor

@crapStone crapStone commented Oct 7, 2023

cargo leptos watch compiles frontend and server code completely new, without using incremental compilation.

This is a bug of cargo or rustc, because changing the target from native to wasm32 changes the RUSTFLAGS which in turn triggers a complete rebuild by cargo (see rust-lang/cargo#8716).

This PR introduces a new option in the project settings (separate-front-target-dir) that instructs cargo leptos to change the --target-dir for the frontend compilation to <project-taget-dir>/front so that the RUSTFLAGS stay the same between the compilations.

@crapStone crapStone marked this pull request as ready for review October 7, 2023 13:05
@gbj gbj merged commit 3bdaa8d into leptos-rs:main Oct 13, 2023
8 checks passed
@crapStone crapStone deleted the fix/incremental-compilation branch October 14, 2023 19:00
@OvermindDL1
Copy link

Just as a passing question, shouldn't this just have been a new cargo profile instead of a new cargo target directory?

@benwis
Copy link
Contributor

benwis commented Nov 13, 2023

Just as a passing question, shouldn't this just have been a new cargo profile instead of a new cargo target directory?

The cargo bug linked says that a new target dir is required, beyond that I cannot say. I think it's a bit easier to have cargo-leptos create a new dir than it is to create and apply a new profile

g2p added a commit to g2p/cargo-leptos that referenced this pull request Feb 8, 2024
The change in leptos-rs#216 was not actionable and contradicted the way the
option was documented in the README.

See leptos-rs#203 and leptos-rs#217.
benwis pushed a commit that referenced this pull request Feb 13, 2024
The change in #216 was not actionable and contradicted the way the
option was documented in the README.

See #203 and #217.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants