Skip to content

@unpic/astro throwing require is not defined. #194

Description

@godspeed0310

I'm using Astro+Cloudflare Integration w/ Workers+Unpic+Directus.

  1. I installed @unpic/astro as a dep.
  2. I added the Image component (From @unpic/astro/base) and the imageService in astro config (Code attached below).
  3. I added the directus transformer.
  4. As soon as I run the app it throws the error mentioned.

Code:

<Image
      style={`view-transition-name: item-${article.data.id}-image;`}
      src={article.data.featured_image}
      alt={article.data.title}
      aspectRatio="16/9"
      class="rounded-sm"
      transformer={transform}
      layout="constrained"
      breakpoints={[270, 315, 354, 400, 486, 500, 736, 992]}
      sizes="(min-width: 1540px) 486px, (min-width: 1280px) 400px, (min-width: 1040px) 315px, (min-width: 780px) 354px, (min-width: 580px) 500px, calc(91.92vw - 15px)"
      width={500}
      loading="lazy"
    />

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions