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({ integrations: [react(), tailwind({
applyBaseStyles: false applyBaseStyles: false
})], })],
build: {
rollupOptions: {
external: [
"sharp"
]
}
},
output: "server", output: "server",
adapter: vercel() adapter: vercel()
}); });

BIN
bun.lockb

Binary file not shown.

View File

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

View File

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