How to import Local packages into Edge functions in monorepo?
I've created a utility package for sharing functions across a turborepo environment. I am having issues importing functions from my monorepo utils package when there are additional imports in that package source file.
In my import_map.json:
{
"imports": {
"@utils": "../../packages/utils/src/testDenoImport.ts"
}
}
This works fine when my testDenoImport.ts file looks like this:
export function helloWorld(name: string) {
console.log("Hello ", name);
}
As soon as I have additional dependencies and it looks like this:
import { decode } from "base64-arraybuffer";
export function helloWorld(name: string) {
console.log("Hello ", name);
}
export async function decodeImage(imageBase64: string) {
return decode(imageBase64);
}
The edge functions stop working:
InvalidWorkerCreation: worker boot error: failed to create the graph: Relative import path "base64-arraybuffer" not prefixed with / or ./ or ../ and not in import map from "file:///Users/..../packages/utils/src/testDenoImport.ts"
Any help would be appreciated!
1 Reply
Hey, did you ever find a solution to this?