cargo-web icon indicating copy to clipboard operation
cargo-web copied to clipboard

Selectively exclude rs files from watch when using web start

Open ecumene opened this issue 4 years ago • 1 comments

My build script parses large and constant text files to spit their content into a constants.rs file. The reason for this is to ignore file loading headaches, by already having the file loaded in memory by the time you execute the program.

cargo web start is incompatible with this, because it watches all source files for changes. When a file is changed (like main.rs), it launches a build. The build generates a new constants.rs, and the build restarts again and again, until I kill the process.

I recommend a regex or array in the Web.toml where you can include files to be excluded by the watch, to allow codegen tools and file watching to coexist peacefully :smile:!

ecumene avatar Dec 26 '19 02:12 ecumene

A temporary fix is to include a flag for your script to run, but that only works in the case where you can get away with running it once in a while

https://stackoverflow.com/questions/52422256/how-can-i-make-running-a-cargo-build-script-optional

ecumene avatar Dec 26 '19 02:12 ecumene