Use `deno.json` configuration file in Edge Functions

Nov 5, 2024

Each Edge Function can now have its own deno.json or deno.jsonc file to manage dependencies. You will need to deploy your functions using Supabase CLI version v1.215.0 or above to make use of this feature.

How to use deno.json#

Create a deno.json in your function's folder:


_10
// supabase/functions/function-name/deno.json
_10
{
_10
"imports": {
_10
"lodash": "https://cdn.skypack.dev/lodash"
_10
}
_10
}

You can now use aliased imports in your source code:


_10
// supabase/functions/function-name/index.ts
_10
import lodash from 'lodash'

To test your function locally, run supabase functions serve. When you're ready, you can deploy it to hosted platform by running supabase functions deploy function-name

For more details, check the guide: https://supabase.com/docs/guides/functions/import-maps#using-denojson-recommended

Build in a weekend, scale to millions