Dfx.json build scripts

It would be really nice to be able to write my own scripts that are executed as part of the dfx build or dfx deploy commands. For example, I have just run into the issue where my Rust binary is too large for dfx to accept it. The solution for now has been to use ic-cdk-optimizer, but running that tool requires me to setup my own process to run the optimizer after the original wasm binary has been created. I could use the “build” field of the dfx.json, but that would require me to setup a cargo flow that I would prefer to avoid.

So for now I’m going to invite myself and others who use Sudograph, when their binaries get too large (will easily happen as GraphQL schemas increase in size), to create npm scripts to deploy instead of using dfx deploy.

I also think post-build and pre-build scripts would be great, I’ve written previously about this here: Configure pre-build and post-build npm scripts

1 Like