RafidMuhymin / astro-imagetools

Image Optimization tools for the Astro JS framework

Home Page:astro-imagetools-docs.vercel.app

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Check for `isSsrBuild` is incorrect

johnzanussi opened this issue · comments

When using @astro/vercel adapter with the static target this plugin incorrectly sets isSsrBuild to true which causes the build to fail.

https://docs.astro.build/en/guides/integrations-guide/vercel/#targets

// astro.config.mjs
import vercel from '@astrojs/vercel/static';

export default defineConfig({
    ...
    output: 'static',
    adapter: vercel(),
    ...
});

astro-imagetools/integration/index.js

// astro-imagetools/integration/index.js
export default {
  name: "astro-imagetools",
  hooks: {
    "astro:config:setup": async function ({ config, command, updateConfig }) {
      const environment = command;

      const isSsrBuild = command === "build" && !!config.adapter;
      ...

It seems as if an additional check for config.output === 'server' is necessary to support Vercel's static output target.

I'm happy to open a PR to fix this issue if ya'll are accepting them.

I created a PR for the fix. #158

Thanks for opening the issue. Closing this since #158 has been merged.