PlayForm / Compress

🗜️ Compress —
https://NPMJS.Org/@playform/compress
MIT License
484 stars 12 forks source link

Throws error in vercel & also in cloudflare #276

Closed JojokCreator closed 7 months ago

JojokCreator commented 7 months ago

When building a static site on Vercel I'm getting an error thrown

21:11:35.912 | free(): invalid size
21:11:35.912 | free(): invalid size

and sometimes it just freezes after generating optimized images

I've tried

compress({ Image: false }),

But still no luck.

I also tried on cloudflare but the same error. Builds okay locally.

NikolaRHristov commented 7 months ago

Heck, can you try replacing Path with just:

export default (await import("astro/config")).defineConfig({
    integrations: [
        (await import("astro-compress")).default({
            Path: ["./dist"],
        }),
    ],
}) as typeof defineConfig;

import type { defineConfig } from "astro/config";

The support for Astro's default image compression directory has been added in the latest 2.2.9 -> _astro to remove it just try the above.

JojokCreator commented 7 months ago
    (await import("astro-compress")).default(
      {
        Path: ["./dist"],
      },
    ),

This seems to fix the error. But it's still resizes all the images when I add { Image: false }

    (await import("astro-compress")).default(
      {
        Path: ["./dist"],
      },
      { Image: false }
    ),
NikolaRHristov commented 7 months ago
    (await import("astro-compress")).default(
      {
        Path: ["./dist"],
      },
    ),

This seems to fix the error. But it's still resizes all the images when I add { Image: false }

    (await import("astro-compress")).default(
      {
        Path: ["./dist"],
      },
      { Image: false }
    ),

Do:

(await import("astro-compress")).default({
    Path: ["./dist"],
    Image: false,
}),
JojokCreator commented 7 months ago

Perfect thanks.

JojokCreator commented 7 months ago

Sorry...

it's back again using the config above on both vercel and cloudflare.

generating optimized images
--
09:09:54.680 | free(): invalid size
09:14:20.856 | Error: Command "npm run build" exited with SIGABRT