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

dx serve shouldn't clear the target build directory. #3226

Open
sbant opened this issue Nov 16, 2024 · 3 comments
Open

dx serve shouldn't clear the target build directory. #3226

sbant opened this issue Nov 16, 2024 · 3 comments

Comments

@sbant
Copy link

sbant commented Nov 16, 2024

Problem

When use new version of dioxus-cli ( 0.6.0-alpha.5 ) in Windows,
run
dx serve
clear the target directory everytime.

My program need some dlls and config files.

Expected behavior

Just overwrite the build output like old version.

Environment:

  • Dioxus version: 0.6.0-alpha.5
  • OS info: Windows 11
  • App platform: desktop
@sbant
Copy link
Author

sbant commented Nov 28, 2024

I tried edit "dioxus/blob/main/packages/cli/src/build/request.rs"

comment line 571
_ = remove_dir_all(self.exe_dir());
to
//_ = remove_dir_all(self.exe_dir());

I'm not sure this is the right approach, but this make my program recompile, hot reload and run all successful.

@DogeDark
Copy link
Member

We need to clear the build folders on rebuilds as some items such as old assets won't be deleted and may be unintentionally used. I have also heard that overwriting has caused corruption issues in the past though I'm unfamiliar with that.

For moving DLLs, you should generally be using a build.rs that copies the DLLs to the location you need them.

@sbant
Copy link
Author

sbant commented Nov 30, 2024

I think use build.rs, copy DLLs and config files everytime before rebuild is not a good solution.

The program config maybe changed during running and save to files, as current dioxus-cli clear entire directory, if those config files not saved to another location, and suddenly rebuild in dioxus-cli, then all config files loss.

dioxus cli also does not have some way to do post build task.

If there must some old assets need to be cleared, then user can also use build.rs to clear them.

Additionaly, dx serve is for development. I think it's right dx bundle clear the target directory, but not dx serve

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

No branches or pull requests

2 participants