{"id":25262,"library":"esbuild-azure-functions","title":"esbuild-azure-functions","description":"A blazingly fast builder for Azure Functions powered by esbuild, version 2.0.1. It compiles TypeScript Azure Functions into optimized bundles, reducing cold starts and deployment times. Active development as of 2023, with a focus on speed and small bundle sizes compared to traditional Azure Functions tooling. Supports watch mode and provides plugins for __dirname and require shimming. Requires esbuild v0.17.5+ as a peer dependency.","status":"active","version":"2.0.1","language":"javascript","source_language":"en","source_url":"https://github.com/beyerleinf/esbuild-azure-functions","tags":["javascript","esbuild","azure","functions","typescript"],"install":[{"cmd":"npm install esbuild-azure-functions","lang":"bash","label":"npm"},{"cmd":"yarn add esbuild-azure-functions","lang":"bash","label":"yarn"},{"cmd":"pnpm add esbuild-azure-functions","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Peer dependency for the bundling functionality","package":"esbuild","optional":false}],"imports":[{"note":"ESM-only since v2.0.0; CommonJS require will fail.","wrong":"const build = require('esbuild-azure-functions')","symbol":"build","correct":"import { build } from 'esbuild-azure-functions'"},{"note":"Synchronous build variant for simple scripts.","wrong":"import { buildSync } from 'esbuild'","symbol":"buildSync","correct":"import { buildSync } from 'esbuild-azure-functions'"},{"note":"Use 'import type' to avoid runtime errors in TypeScript.","wrong":"import { BuildOptions } from 'esbuild-azure-functions'","symbol":"type BuildOptions","correct":"import type { BuildOptions } from 'esbuild-azure-functions'"},{"note":"Library version is not re-exported from the main entry.","wrong":"","symbol":"Version","correct":"import { version } from 'esbuild-azure-functions/package.json'"}],"quickstart":{"code":"import { build } from 'esbuild-azure-functions';\n\n// Build all functions in the 'functions' directory\nbuild({\n  entryPoints: ['functions/**/*.ts'],\n  outdir: 'dist/functions',\n  platform: 'node',\n  target: 'node14',\n  bundle: true,\n  minify: true,\n  sourcemap: true,\n}).catch((err) => {\n  console.error('Build failed:', err);\n  process.exit(1);\n});\n\n// For watch mode, pass watch: true\nbuild({\n  entryPoints: ['functions/**/*.ts'],\n  outdir: 'dist/functions',\n  watch: true,\n}).catch((err) => {\n  console.error('Build failed:', err);\n  process.exit(1);\n});","lang":"typescript","description":"Shows basic build and watch mode for Azure Functions using esbuild-azure-functions."},"warnings":[{"fix":"Ensure your project's esbuild version is >=0.17.5 and update any custom plugins accordingly.","message":"Version 2.0.0 updated esbuild peer dependency to v0.17.5, which may break custom esbuild plugins or configurations.","severity":"breaking","affected_versions":">=2.0.0"},{"fix":"Use 'import' syntax or set 'type':'module' in package.json.","message":"In v2.0.0, the package switched to ESM-only, breaking CommonJS require() calls.","severity":"breaking","affected_versions":">=2.0.0"},{"fix":"Set watch: true to enable watch mode. Custom watchers are not supported.","message":"The 'watch' option expects a boolean; passing an object or string may silently fail or be ignored.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Define external dependencies in esbuild options (e.g., external: ['@azure/functions']) to exclude from bundle.","message":"The library does not automatically include Azure Functions runtime dependencies; you must bundle them explicitly or rely on the Azure Functions host.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Upgrade to v2.0.0 or later.","message":"Version 1.x is no longer maintained and lacks ESM support.","severity":"deprecated","affected_versions":"<2.0.0"}],"env_vars":null,"last_verified":"2026-05-01T00:00:00.000Z","next_check":"2026-07-30T00:00:00.000Z","problems":[{"fix":"Add an 'entryPoints' array to the build options, e.g., entryPoints: ['functions/**/*.ts'].","cause":"No entryPoints specified in the build options object.","error":"Error: You need to provide at least one entry point"},{"fix":"Switch to 'import { build } from 'esbuild-azure-functions'' and ensure your project uses ESM.","cause":"Using CommonJS require() on an ESM-only module.","error":"TypeError: esbuild_azure_functions_1.build is not a function"},{"fix":"Add '@azure/functions' to the 'external' list in esbuild options, or install it and bundle it.","cause":"The Azure Functions npm package is not installed or is not marked as external.","error":"Could not resolve '@azure/functions'"},{"fix":"Set watch: true or watch: false explicitly.","cause":"watch parameter was set to a non-boolean value like a string or object.","error":"Invalid option 'watch': expected a boolean"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}