#✔ Optimising with @astrojs/image and Sharp ends in build failure

1 messages · Page 1 of 1 (latest)

prime topaz
#

I'm at the stage in my site build that I wanted to move on to optimising all images. I have set up according to instructions, including the Sharp package. Things work fine with image/picture resizing and formatting to WebP. But the whole setup fails at build time.

Anyone seen this before?

#

Running Node V19. And here's my Astro config file:

`import { defineConfig } from "astro/config";
import tailwind from "@astrojs/tailwind";
import image from "@astrojs/image";

export default defineConfig({
integrations: [
tailwind({
config: {
applyBaseStyles: false,
},
}),
image({
serviceEntryPoint: "@astrojs/image/sharp",
}),
],
defineConfig: {
output: "static",
},
});`

jovial warren
#

You could try downgrading Node to v18

prime topaz
#

Btw, I also updated my tconfig.json like this:

{ "extends": "astro/tsconfigs/base", "compilerOptions": { "baseUrl": ".", "paths": { "@components/*": ["src/components/*"], "@assets/*": ["src/assets/*"] } } }

#

@jovial warren Okay, I had that in mind. I haven't done that before. Do you have a link to how-to?

jovial warren
# prime topaz <@235888874327375892> Okay, I had that in mind. I haven't done that before. Do y...

I have never done it before so I am not too sure, a answer on stack overflow says you could do this for windows ```shell
npm uninstall -g node

npm install -g node@[version]

prime topaz
#

I'll find it. Thanks. Good tip 👍🏻

prime topaz
#

@jovial warren I figured out what this one was about. My bad in my code. Funny situation as I was having a FaceTime call with my girlfriend. I suddenly spotted the code in the background:

#

The "Image" module is not using "formats" like the "Picture" module does. It only use "Format" and one value. The build and deploy completed now 👍🏻