Configuration
How to configure esbuild-azure-functions.
How to configure
How you configure esbuild-azure-functions depends on if you are using the CLI or calling programmatically. We recommend calling esbuild-azure-functions programmatically, though.
Configuring on the CLI
By default, esbuild-azure-functions expects a file called esbuild-azure-functions.config.json
in the current working directory. You can, however, specify a file using the -c | --config
flag.
Configuring in the code
If you are calling esbuild-azure-functions programmatically, you can simply pass the config object to the build
or watch
function.
Properties
These properties are available
Project
Required: yes
Type: string
Default: undefined
Supported by: build
, watch
The root folder of the Azure Functions project you want to build.
Entry Points
Required: no
Type: string[]
Default: undefined
Supported by: build
, watch
Specify custom entry points if you don't want esbuild-azure-functions to search for index.ts files in the project
folder.
Exclude
Required: no
Type: string[]
Default: undefined
Supported by: build
, watch
Specify directories as glob patterns to exclude when searching for index.ts files.
Clean
Required: no
Type: boolean
Default: false
Supported by: build
, watch
Specify whether esbuild-azure-functions should delete the output directory before building.
Log Level
Required: no
Type: "off" | "error" | "warn" | "info" | "verbose"
Default: "error"
Supported by: build
, watch
Specify the verbosity of log messages.
esbuild options
Required: no
Type: Refer to official docs
Supported by: build
, watch
Customize the esbuild confg that esbuild-azure-functions uses.
Note: Modifying this can lead to unexpected behavior. You should never set write
to true since esbuild-azure-functions write the output files itself.
Advanced options
Enable some advanced options depending on your environment.
Enable __dirname
Shim
__dirname
ShimRequired: no
Type: boolean
Default: false
Supported by: build
, watch
Enables a plugin that patches __dirname
and __filename
using import.meta.url
(see official Node.js docs) at the top of every output file because they are not available in ESM and esbuild doesn't shim them itself.
Enable require
Shim
require
ShimRequired: no
Type: boolean
Default: false
Supported by: build
, watch
Enables a plugin that patches require
using import.meta.url
at the top of every output file because esbuild doesn't support converting CJS requires to ESM imports.
Callbacks
These callbacks are available to hook into the build process. These are only available when esbuild-azure-functions is used in code.
onRebuild
Required: no
Type: function
Parameters: (error: BuildFailure | null, result: BuildResult | null)
Default: undefined
Supported by: watch
Callback that's called for every rebuild.
Last updated