mega compile
Thecompile command (also aliased as mega build) compiles Solidity contracts using Foundry’s Forge under the hood.
Usage
Options
Mega CLI passes all options directly to Forge. Here are some commonly used options:| 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 |
The
mega compile command supports all options available in forge build.
See the Forge documentation for a complete list.Description
This command compiles your Solidity contracts using Foundry’s Forge compiler. It’s a wrapper aroundforge build that ensures compatibility with the Mega CLI workflow while providing access to all of Forge’s powerful compilation options.

