Configure Ant at runtime using ANT_DEBUG flags, CLI options, process.env variables, and package.json scripts for development and production use.
Ant’s runtime behavior is controlled through three mechanisms: the ANT_DEBUG environment variable for low-level debug output, CLI flags for process-level options, and process.env for application configuration. You don’t need a config file to get started — all options are available at the shell level and work consistently across platforms.
Ant reads the ANT_DEBUG environment variable at startup. Use it to enable internal debug output for the parser, compiler, VM, or garbage collector. Multiple flags can be combined in a single string, separated by spaces.Each flag uses the form key:value:
These flags are handled directly by the Ant process before any JavaScript runs. Pass them before the script filename.
Flag
Description
--verbose
Enable verbose output from the package manager and CLI commands
--no-color
Disable colored terminal output
--stack-size=<kb>
Override the default JavaScript stack size in kilobytes
--localstorage-file <path>
Path to a file for persisting localStorage data across runs
-e, --eval <script>
Evaluate a JavaScript string directly
-p, --print
Evaluate a script and print the result
-w, --watch
Restart the process when the entry file changes
--no-clear-screen
Keep output when restarting in watch mode (requires --watch)
-v, --version
Print version information and exit
-h, --help
Print help and exit
# Run with a custom stack sizeant --stack-size=4096 src/index.ts# Run in watch mode without clearing the terminalant --watch --no-clear-screen src/index.ts# Persist localStorage to a fileant --localstorage-file ./data/storage.json src/index.ts# Evaluate a one-linerant -e "console.log(Ant.version)"
For full documentation on running scripts and watch mode, see the CLI reference.
You can also invoke a script by name directly if there’s no filename conflict — ant dev works if dev is defined in scripts and there’s no file named dev.js in the current directory.
By default, localStorage and sessionStorage are in-memory and reset between runs. To persist localStorage across invocations, pass a file path with --localstorage-file:
ant --localstorage-file ./storage.json src/index.ts
Ant reads the file on startup and writes to it on exit. The file is created automatically if it doesn’t exist. sessionStorage is always in-memory regardless of this flag.