bundling fails when trying to use an importMap
deckchairlabs opened this issue · comments
Describe the bug
I'm encountering an error when trying to deploy to Netlify, and specifying an importMap in my .netlify/edge-functions/manifest.json
. I've created a repo which reproduces my issue. https://github.com/deckchairlabs/ultrajs-netlify-edge
Note: running netlify dev
works without issue.
error: Uncaught (in promise) Error: Relative import path "ultra/server.ts" not prefixed with / or ./ or ../
var ret = new Error(getStringFromWasm0(arg0, arg1));
^
at __wbg_new_55259b13834a484c (https://deno.land/x/eszip@v0.18.0/eszip_wasm.generated.js:389:17)
at <anonymous> (https://deno.land/x/eszip@v0.18.0/eszip_wasm_bg.wasm:1:64387)
at <anonymous> (https://deno.land/x/eszip@v0.18.0/eszip_wasm_bg.wasm:1:1546059)
at <anonymous> (https://deno.land/x/eszip@v0.18.0/eszip_wasm_bg.wasm:1:1978661)
at __wbg_adapter_24 (https://deno.land/x/eszip@v0.18.0/eszip_wasm.generated.js:213:6)
✖ Deploy aborted due to error while bundling edge functions
importMap.json
{
"imports": {
"react": "https://esm.sh/react@18.2.0?dev",
"react/": "https://esm.sh/react@18.2.0/",
"react-dom": "https://esm.sh/react-dom@18.2.0",
"react-dom/server": "https://esm.sh/react-dom@18.2.0/server?dev",
"react-dom/client": "https://esm.sh/react-dom@18.2.0/client?dev",
"ultra/": "https://deno.land/x/ultra@v2.0.0-beta.2/"
}
}
.netlify/edge-functions/manifest.json
{
"functions": [
{
"function": "index",
"pattern": "^[^.]*$"
}
],
"import_map": "../../importMap.json",
"version": 1
}
I think the issue is to how your resolving specifiers in the passed importMap. I usually use this when dealing with importMaps https://www.npmjs.com/package/@import-maps/resolve
https://github.com/netlify/edge-bundler/blob/main/deno/lib/stage2.ts#L62-L64
Reopening until this has been fully rolled out.
@deckchairlabs apologies for the delay on this. Would you mind trying again? This should've been fixed with the latest version of the CLI.
@eduardoboucas fantastic! And no apologies needed, I'll have a play and report back!
New issue found @eduardoboucas #127
Okay, closing this one and moving the conversation over to #127.