fix: remove sharp optimization

This commit is contained in:
log101 2024-02-21 13:34:09 +03:00
parent 731775008e
commit a1a54b0294
4 changed files with 2 additions and 18 deletions

View File

@ -9,13 +9,6 @@ export default defineConfig({
integrations: [react(), tailwind({
applyBaseStyles: false
})],
build: {
rollupOptions: {
external: [
"sharp"
]
}
},
output: "server",
adapter: vercel()
});

BIN
bun.lockb

Binary file not shown.

View File

@ -34,7 +34,6 @@
"nanoid": "^5.0.4",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"sharp": "^0.33.2",
"tailwind-merge": "^2.2.0",
"tailwindcss": "^3.4.1",
"tailwindcss-animate": "^1.0.7",
@ -43,8 +42,5 @@
"devDependencies": {
"@types/bun": "^1.0.5",
"@types/google.maps": "^3.54.10"
},
"trustedDependencies": [
"sharp"
]
}
}

View File

@ -1,6 +1,4 @@
import { createClient } from "@supabase/supabase-js"
import sharp from "sharp"
import type { APIRoute } from "astro"
import { createKysely } from "@vercel/postgres-kysely"
import { customAlphabet } from "nanoid"
@ -40,11 +38,8 @@ export const POST: APIRoute = async ({ request }) => {
const randomImageId = nanoid()
const imageName = `${image.name.replace(/\.[^/.]+$/, "")}${randomImageId}.jpg`
const imagebuf = await image.arrayBuffer()
const compressed = await sharp(imagebuf).toFormat("jpg", { quality: 75 }).toBuffer()
const { data, error } = await supabase.storage.from("images").upload(`public/${imageName}`, compressed, {
const { error } = await supabase.storage.from("images").upload(`public/${imageName}`, image, {
cacheControl: "3600",
upsert: false
})