Compile Solidity contracts using Foundry
compile
command (also aliased as mega build
) compiles Solidity contracts using Foundry’s Forge under the hood.
Option | Description |
---|---|
--names | Print compiled contract names |
--sizes | Print compiled non-test contract sizes |
--force | Clear the cache and recompile |
--optimize | Activate the Solidity optimizer |
--watch | Watch for changes and recompile |
mega compile
command supports all options available in forge build
.
See the Forge documentation for a complete list.forge build
that ensures compatibility with the Mega CLI workflow while providing access to all of Forge’s powerful compilation options.