#glob() imported component with client:load throws error

2 messages · Page 1 of 1 (latest)

fringe coyote
#

Hey everyone 👋

https://github.com/withastro/astro/issues/7287

Im getting and error when trying to hydrate components that ive imported via the astro.glob() function.
Im working on a lightweight foss cms and want to move to Astro as it would fairly easy allow me to make it framework agnostic.

In my index.astro im importing my svelte components using

const svelteComponents = await Astro.glob('../components/*.svelte');

and rendering as explained in the docs like:

{svelteComponents.map((comp) => <comp.default/>)}

this works fine, but Im not able to hydrate them using client:load without getting an Exception.

Ive created a Stackblitz showcasing my issue:
https://stackblitz.com/edit/stackblitz-starters-amlrvz?file=src%2Fpages%2Findex.astro

I coudnt find anything on the docs or forums regarding this Issue.
I would be very happy if someone could forward me any posts, docs, etc to me or directly giving me a solution to this here.

The Exception:

 error   Unable to resolve a valid export for "comp.default"! Please open an issue at https://astro.build/issues!
  File:
    /Users/janeckerlein/development/web/glob-import-client-load-issue/node_modules/astro/dist/runtime/server/hydration.js:79:11
  Code:
    78 |     children: "",
    > 79 |     props: {
         |           ^
      80 |       // This is for HMR, probably can avoid it in prod
      81 |       uid: astroId
      82 |     }

Thanks in advance

GitHub

What version of astro are you using? 2.5.7 Are you using an SSR adapter? If so, which one? none What package manager are you using? npm What operating system are you using? mac What browser are you...

Starter project for Node.js, a JavaScript runtime built on Chrome's V8 JavaScript engine

wispy anvilBOT
#
No-one around right now?

It looks like no-one has responded to your question yet. People might not be available right now or don’t know how to answer your question. Want an answer while you wait? Try asking our experimental bot in #1095492539085230272.