Supabase edge functions and local imports
I'm struggling with figuring out the best way to deploy edge functions which take a dependency on classes or methods defined elsewhere in my repository. I see a lot of posts online around
_shared folders, deno.json and import_map.
How do I use deno.json for a local import from another place in my repo? Do I need to modify the supabase function deploy <function_name> CLI command in any way?
The issue I'm running into now is something like -
6 Replies
I’ve used a shared file with cors settings, but I don’t have it in front of me
@SD but supabase doesn't recommand to use the global deno.json file . recommand to use the seperate file for each edge function

Right I saw that. I think maybe my understanding of how the packaging is done for
supabase function deploy is insufficient, or I don't know enough about Deno.
I also realized that what I wanted to import itself has some imports done without the typescript .ts extension (like import _ from './file'. And deno doesn't allow thatYou can have a dir structure like this. For example you can import any export from cors.ts file.

Also,
.ts extension in import statement is necessaryNoted, thanks!