Watch API

The Watch API is just like the Build API but uses esbuild's built-in file watcher to automatically rebuild your project when you change something.

Use Programmatically

Simply import the watch function and pass it your config (it's typed!). Refer to the Configuration page for more info.

build.mjs
import { watch } from 'esbuild-azure-functions';

await watch({
  /* your config here */
});

Use on the CLI

Usage on the CLI is straight forward. Either create a file called esbuild-azure-functions.config.json in the directory you want to run esbuild-azure-functions from or pass the -c | --config flag to specify a file at a custom location.

Most importantly, specify the -w | --watch flag to enable watch mode.

npx esbuild-azure-functions -w [-c <config location>]

Last updated